I'm running ArcGIS 10.3.1. and desire to list layers in the current mxd. I'm using the "CURRENT" method...
...within a python script tool, accessed via a single ArcMap session with the environment setting set to foreground processing. The usage is correct (identical to the help) and has worked for me last year. why would a foreground process fail to find the single mxd that it's being run from?
import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") for lyr in arcpy.mapping.ListLayers(mxd): arcpy.AddMessage(lyr.name) del mxd arcpy.AddMessage(" ... current mxd ")