Script ending at loop

423
5
06-23-2014 06:28 AM
GeoffOlson
Occasional Contributor
I'm having an issue getting a loop to run in my map.  Something as simple as just trying to print "yay" won't iterate.  Here's what I have to even a test that I can't get to run.  Am I missing something?

mxd = arcpy.mapping.MapDocument("Current")
mapLyr1 = arcpy.mapping.ListLayers(mxd, "sampleLayer") [0]
cursor = arcpy.SearchCursor(mapLyr1)
for row in cursor:
 print "yay"
Tags (2)
0 Kudos
5 Replies
GeoffOlson
Occasional Contributor
I tried the same script in a different mxd and it worked fine.  But it still won't run in the map I created it for.  What might cause this?
0 Kudos
markdenil
Regular Contributor II
are there any rows in the table?
0 Kudos
GeoffOlson
Occasional Contributor
Yeah, it's not the layer name.  Is it possible for an mxd to become corrupt that certain functions won't run?
0 Kudos
GeoffOlson
Occasional Contributor
I created a new mxd with my layers in it and it's working.  So I don't know what caused the issue to begin with.
0 Kudos
Zeke
by
Regular Contributor III
You might try running MXD Doctor on your original map.
0 Kudos