I know this is something simple but for some reason I am having trouble remembering. In my code I am getting a name is not define for sheet_count. This means I would have to define at top correct. For Example: Is it sheet_count = true? My code is below:
import arcpy, os, sys, string
from os import path as p
from arcpy import mapping as m
#Make parameters for people to choose mxd and folder of PDFs to compare
mxdList = string.split(arcpy.GetParameterAsText(0), ";")
pdf_path = arcpy.GetParameterAsText(1)
#Use Search Cursor to go through Attribuite Table to get Sheet number info
for mapDoc in mxdList:
arcpy.AddMessage(mapDoc)
mxd = arcpy.mapping.MapDocument(mapDoc)
for lyr in m.ListLayers(mxd, "*, Grid"):
if lyr.description == "*, Grid":
max_list = []
rows = arcpy.SearchCursor(lyr)
for row in rows:
max_list.append(row.Sheet_ID)
sheet_count = max(max_list)
arcpy.AddMessage('Sheet count: %s'%sheet_count)
print 'Sheet count: %s'%sheet_count
else:
arcpy.AddError('No Layers in %s match data source'%mapDoc)