A part of my script where I extract the view definition is returning an empty string when I run it, but if I run the same exact code in ArcGIS, I get the correct return.
It is only for the desc.whereClause return, the others such as desc.name, desc.nameString are working correctly.
Anyone know what could be causing this?
mxdpath = r"C:\...\blah.mxd"
mapDoc = arcpy.mapping.MapDocument(mxdpath)
dataFrames = arcpy.mapping.ListDataFrames(mapDoc)
for i in range(0,len(dataFrames)):
lyrs = arcpy.mapping.ListLayers(mapDoc,"",dataFrames[i])
for j in range(0,len(lyrs)):
if lyrs[j].isFeatureLayer:
desc = arcpy.Describe(lyrs[j])
print "Name string: " + desc.nameString
print "Where Clause: " + desc.whereClause
This code returns a blank u'' for desc.whereClause, however the same code will produce something like 'objectId = 1' if I run it in the python app inside ArcMap Desktop
mxdpath = 'CURRENT'?