AnsweredAssumed Answered

ExporttoPNG Python for MapSeries

Question asked by eayarbe on Feb 25, 2019

I'm trying to export my ArcGIS Pro map series to PNG.  I'm using the MapSeries example code #2 from Esri ( ).  I keep getting an Invalid page number error. 


Any help is much appreciated!!


See below code and error:


import arcpy, os, sys
relpath = "Z:\\41708.02 VAGuidehouse - MAHSO Call 1\\300TIG\\315Maps\\Maps_DDF"

aprx ="CURRENT")
l = aprx.listLayouts()[0]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
for pageNum in range(1, ms.pageCount + 1):
ms.currentPageNumber = pageNum
pageName = ms.pageRow.Market
l.exportToPNG(relpath + "\\PNG_Test\\S7_MKTOVW_{0}".format(ms.pageRow.Market) + ".png")




Traceback (most recent call last):
File "<string>", line 10, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\arcobjects\", line 109, in _set
return setattr(self._arc_object, attr_name, cval(val))
ValueError: Invalid page number '1'.