I am having a hard time trying to figure out this. I have a .txt file with township/range/sections that I need to read and than zoom to the section, refresh the map and export files from it and than go to the next one. Here is the code:
import arcpy
mxd = arcpy.mapping.MapDocument("M:\\par-prod\\checking\\bookmaps.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Legal")[0]
lyr = arcpy.mapping.ListLayers(mxd, "GCDB*", df)[0]
data_file = open('todo.txt', 'r')
for item in data_file:
print item
rows = arcpy.SearchCursor(lyr)
row = rows.next()
while row:
trs = row.getValue("TOWN")
if trs == item:
print "Township Range Section is "+trs
row = rows.next()
del rows
I know it reads the list (with the first print) but it only gets to the next print for the last item in the list. No matter how many are in the list it only seems to do the last item. What am I not seeing?