I literally copied and pasted the file path (r'C:\Users\myName\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\mydatabase.sde'), but after I run my script, I always get the error saying error 267, the directory name is invalid.
1 Answer
This works for me to access ArcSDE feature classes in feature datasets;
wrkspc = r"D:\Projects\DotNetDataLoader\Connection to xxx.xx.x.xxx.sde"
arcpy.env.workspace = wrkspc
listds = arcpy.ListDatasets("*"):
for ds in listds:
listfc = arcpy.ListFeatureClasses("*","",feature_dataset=ds)
for fc in listfc:
print fc
-
3If there are feature classes outside of datasets, then you also need a
arcpy.ListFeatureClasses
without afeature_dataset
parameter. And tables without geometry would needarcpy.ListTables
.– VinceCommented Jul 5, 2019 at 15:44 -
i think this is almost what i want, except it isn't working for me? If i only want to access sde tables, do i change the ListFeatureClasses to ListTables? Commented Jul 5, 2019 at 15:58
-
yes I think that would be best if they are non spatial tables. Commented Jul 5, 2019 at 15:59
.sde
file is not a directory. It is a file. OS tools will not see it as an ArcGIS workspace, suitable forListFeatureClasses