Map Series Arcpy- help needed

03-16-2018 10:30 AM
Occasional Contributor II

ArcGIS Pro Hi, I have a script which is meant to export 10 or so Map Series pages to seperate PDFs. PDFs are to be named by page number.

However, the script runs through to the end without exporting any PDFs. All I get is the two print commands upon completion.

-MapSeries is enabled in the Project.

-I have all appropriate permissions.

Any ideas? I used the example script from: MapSeries—ArcPy | ArcGIS Desktop  to help me.

import arcpy, os, sys
relpath = os.path.dirname(sys.argv[0])

p ="C:\\Users\\Tom\\Documents\\GIS_Tasks\\General_tasker\\General_tasker.aprx")
print ("project located")
l = p.listLayouts()[0]
print ("layouts listed")
if not l.mapSeries is None:
  ms = l.mapSeries
  if ms.enabled:
    for pageNum in range(1, ms.pageCount + 1):
      ms.currentPageNumber = pageNum
      print("Exporting page {0} of {1}".format(str(ms.currentPageNumber), str(ms.pageCount)))
      l.exportToPDF("C:\\Users\\Tom\\Dropbox\\Production\\Internal Automation\\Assess_automation\\Current_assess_site_plans\\Assess_{0}".format(str(ms.currentPageNumber) + ".pdf"))‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Tags (1)
0 Kudos
1 Reply
MVP Legendary Contributor

I would start with 

print("layouts listed {}".format(l))

And see what is next with

print("m enabled {}".format(m.enabled))

You have to print useful information to test