AnsweredAssumed Answered

Cannot list featureclasses in SDE

Question asked by ginomellino on Jun 3, 2020
Latest reply on Jun 3, 2020 by jborgion

Hi All, 


I am trying to list featureclasses in an enterprise GDB via SDE database using the code below. If I run this from within ArcMap/Catalog it works fine - prints out all the featureclass names. If I run this from within pyscripter OR by double clicking the .py it returns fcList as an empty list. Would anyone have any idea why this fails in the stand alone script? It is as if the connection to the SDE is not opened?


I have googled this but am unable to find a solution (this question seems to outline a similar issue arcgis 10.2 - arcpy.ListFeatureClasses returns empty list - Geographic Information Systems Stack Exchange ). I have tried setting the path to the .sde using <database connections> and also by fully qualifying the path but it makes no difference.


Oracle database is using operating system authentication. Currently attempted this on ArcGIS 10.7.1 and 10.6.1 - both do not work. Windows 10 - our IT department have locked it down so we cannot run as administrator - perhaps this is causing the issue?


Happy to provide further information on anything if it can help and any help greatly appreciated!





import arcpy
from arcpy import env
import os

# Establish connection for workspace

env.workspace = r"<path to sde conn file.sde>"

print(os.path.exists(env.workspace)) #Returns True

#call ListFeatureClass function
fcList = arcpy.ListFeatureClasses()
print(len(fcList)) #Returns 0

# Print the name of the current fc:
for fc in fcList: