I have an arcpy-script which I want to execute outside ArcGIS which sould open an SDE-workspace. Therefor I create a new SDE-file by using
arcpy.CreateArcSDEConnectionFile_management. When I use that file within ArcCatalog I can establish the connection to my database, however when I use it in my script I cannot access the actual workspace:
# create the SDE-file and connect to the workspace sdeFileName = user + "@" + server + ".sde" arcpy.CreateArcSDEConnectionFile_management(temp, sdeFileName, server, service, username = user, password = password, version = version) arcpy.env.workspace = temp + os.sep + sdeFileName
Now when iterating the datasets within the workspace I get an empty array:
datasets = arcpy.ListDatasets()
Whereas the SDE DOES have lots of featureDatasets and other tables.
I use PyScripter and when I hover the
arcpy it shows me where those names are defined. However the same does not apply to the
workspace making me wonder if I have to import or load another module where the member is defined.
Do you have any suggestions on how to open that workspace? The lines above are more ore less taken from example 4 on ArcGIS Help-site
EDIT: I tried out using an arbitrary (non-existing) SDE-file. Thus I got an exception on
ListDatasets saying I cannot iterate a
NoneType. So I think my problem is not caused by
workspace not being defined and therefor any module not being loaded as the mentioned method actually DOES return anything, at least an empty array instead of