AnsweredAssumed Answered

Difference between python toolbox and python external ?

Question asked by olivier57 on Feb 27, 2012
Latest reply on Feb 27, 2012 by olivier57
Hi,

I try to list all layers from an mxd. Can someone explain me why it works when launched from toolbox and not from an Idle python script ?

mxd = arcpy.mapping.MapDocument(r"...\my.mxd") for df in arcpy.mapping.ListDataFrames(mxd,"*"):     for lyr in arcpy.mapping.ListLayers(mxd,"*",df):         print df.name + ":" + lyr.name
       

When launched with a tool inside Arcmap 10.0, I get all layers, but from python 2.6 script, it just displays the first layer and stops (Layers:<first layer name>).

Thanks for any help

Olivier

Outcomes