I am writing a standalone python script (i.e not within arcmap) that attempts to extract the coordinates of selected features (as they appear selected in the current map document). The commands that make up my script (see below) work fine if I execute them within the python window in arcmap but not when I try to use them within a standalone script.
mxd= mapping.MapDocument(r'c:\GIS\project\map.mxd)
myLyr= mapping.ListLayers(mxd, 'features')[0]
desc= Describe(myLyr)
NB. 'features' is the name of a point feature layer. The datasource of this layer is within a personal geodatabase i.e. within test.gdb.
The script blows us when it gets to the last command in spite of the fact that myLyr is indeed a layer (I checked this when debugging). I cannot think of what I am doing wrong so any help will be appreciated.
thanks
marc
You have no closing single quote in your mxd line, so this should be a syntax error and not run at all.
desc = Describe(myLyr.dataSource)
MakeFeatureLayer_management(myLyr, "describe_me") desc = Describe("describe_me")
desc = Describe(myLyr.dataSource)
MakeFeatureLayer_management(myLyr, "describe_me") desc = Describe("describe_me")
mxd=arcpy.mapping.MapDocument('CURRENT') df=arcpy.mapping.ListDataFrames(mxd,'Wyoming')[0] test_layer=arcpy.mapping.ListLayers(mxd,'*',df)[1] desc=arcpy.Describe(test_layer) desc.FIDSet