3

ArcMap 10.3.1

It seems that the layer object returned by arcpy.mapping.ListLayers will have a full .dataSource property only in a brand new MXD. After changing the target version in the TOC, the same python returns an incomplete .dataSource and the .workspacePath property is empty.

Any suggestions? Could this be intended behaviour?

Steps:

1) create blank MXD

2) add data from Oracle SDE geodatabase

3) execute python to create layer object and print .dataSource property

4) change version in TOC

5) execute python again

mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
     print(lyr.dataSource)

animation of arcmap session

  • That looks like it might be a bug that Esri needs to be made aware of. Is the dataSource path incorrect if the MXD is saved, closed and reopened or is the problem persisted forever after the target version is changed? – Michael Stimson Jun 21 '17 at 21:11
  • Yes, same behaviour after a save/re-open. I have submitted a ticket with ESRI support and will report back. Thanks for the response. – giJess Jun 22 '17 at 12:22
1

Apparently this is a known issue.

The issue you are experiencing is a known issue:

[BUG-000101443] The 'Datasource' property in ArcPy provides only the dataset name when the database connection and the map document layer are pointing to different versions.

This issue will be addressed, but no time frame is given. Current workaround is to manually change the view to the parent in order to get the complete path to the dataset.

http://support.esri.com/bugs/nimbus/QlVHLTAwMDEwMTQ0Mw==

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.