Thank you all for the responses!Yesterday, when I added a message to tell me the number of items selected in my layer, it was telling me there was one. Today, there is not. At this section of code (when I run this as an arcscript):
arcpy.MakeFeatureLayer_management(WySectns, WySectns_Lyr, "", "", "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;AREA AREA VISIBLE NONE;PERIMETER PERIMETER VISIBLE NONE;STATE_S_ STATE_S_ VISIBLE NONE;STATE_S_ID STATE_S_ID VISIBLE NONE;SECTION_ SECTION_ VISIBLE NONE;TR TR VISIBLE NONE;MERIDIAN MERIDIAN VISIBLE NONE;Shape_Length Shape_Length VISIBLE NONE;Shape_Area Shape_Area VISIBLE NONE")
arcpy.AddMessage("Layers " + str(arcpy.mapping.ListLayers(mxd, "WySectns_Lyr") [0]))
my script returns an error saying that <type 'exceptions.IndexError'>: list index out of rangeFailed to execute (SelectAndZoom). So, in the script, the layer is simply not being created? What am I doing wrong here?When I replace the code with this, it again works in the python window but not in the script, returning the same error:arcpy.MakeFeatureLayer_management(WySectns, WySectns_Lyr)
arcpy.AddMessage("Layers " + str(arcpy.mapping.ListLayers(mxd, "WySectns_Lyr") [0]))
Why is the layer not created when running the script? How do I get it into the map?