I'm working with SDE connection and want to find if a layer exists on a server. Code sample is:

ws = r'Database Connections\Connection to sde-srv.sde'
# second option to access connection file, same result
# ws = r'c:\Users\CurrentUser\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\Connection to sde-srv.sde'

arcpy.env.workspace = ws
fcs = []
for fd in arcpy.ListDatasets():
    for fc in arcpy.ListFeatureClasses(feature_dataset = fd):
print fcs  # []

The problem is that everything is OK if I run this in ArcMap console (fcs contains all the FCs from server), but when runnig it in a standalone script outside the ArcMap app SDE seems to be empty.

On top of it running this script with x32 Python crashes with Win error. With x64 it just returns empty list.

Listing any other sources (GDBs and so on) works well in any case.

arcpy.Exists(ws) returns True in both cases.

*UPD. It's not the same situation as described in 'possible duplicate' question (and few others that I've checked before with almost the same title). There is no problem with full/relative path, absence of FC/FD, encodings, priveleges ...

*UPD2 Win10, ArcGIS, both x32 and x64 (Background processing) Python interpreters installed. RDBMS: Oracle 11g (seems to be 11.2.0)

  • 2
  • Not a duplicate :( There is no issue with full or relative paths, both don't work. Oct 20, 2017 at 9:05
  • Another thread here. may be its a permission issue as discussed?
    – Hornbydd
    Oct 20, 2017 at 9:10
  • 3
    Please Edit the question to specify the exact version of ArcGIS (at this long remove, you should be using the terminal10.2.2 with dozens of patches), the exact RDBMS version, how the RDBMS client library has been configured, and the contents of your PATH environment variable.
    – Vince
    Oct 20, 2017 at 10:22
  • 1
    @SergeNorin so are you saying that your code works without error on another machine, but not the one you are using? Sounds like it could be virus protection software or firewall blocking a connection?
    – Hornbydd
    Oct 20, 2017 at 16:12