Dan, This is very helpful. I took your advice and modified the code you provided and I am getting this error message. Traceback (most recent call last):
File "C:/ArcPyTests/createPDF_datadrivenpages.py", line 5, in <module>
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
AttributeError: 'str' object has no attribute 'dataDrivenPages'
Update: I resolved the problem by switching the code from:
import arcpy
mxd = "C:/ArcPyTests/Untitled.mxd"
mapdoc = arcpy.mapping.MapDocument(mxd)
print "import complete"
for pageNum in range(1, mapdoc.dataDrivenPages.pageCount + 1):
mapdoc.dataDrivenPages.currentPageID = pageNum
to:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:/ArcPyTests/Untitled.mxd")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum