Mapseries losing connection

02-08-2021 11:45 AM
New Contributor II

When exporting mapseries, the first page works, but then when it goes to the second one, it says "Page 2 is not a valid option".

It seems like it's losing connection to the mapseries saying there's only one page in it. 

Using the latest version of Pro 2.7.1 (this did the same thing for 2.6 with me, so I figured the upgrade might have fixed it).


This Mapseries has 6 Pages
1 (print PageNum)
6 (print ms.PageCount)
"MapID" = 'StupidMan123'

Working on map for StupidMan123
Text elements on layout updated
Exporting page to Georeferenced PDF for StupidMan123

2 (print PageNum)
1 (print ms.PageCount)
Traceback (most recent call last):
  File "C:\folderpath\", line 49, in <module>
    ms.currentPageNumber = pageNum
  File "C:\folderpath\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\", line 109, in _set
    return setattr(self._arc_object, attr_name, cval(val))
ValueError: Invalid page number '2'.



Thanks in advance for any ideas.

0 Kudos
2 Replies
Occasional Contributor III

Are you able to post your map series code so we can see how it is working?

0 Kudos
New Contributor II

Here's the functional part of it


mxd ="C:\folderpath\arcpymptest.aprx")
df = mxd.listMaps("Map")[0]
lay = mxd.listLayouts("Layout")[0]
ms = lay.mapSeries

print("This Mapseries has " + str(ms.pageCount) + " Pages")

for pageNum in range(1, ms.pageCount + 1):
    ms.currentPageNumber = pageNum
    MapID = ms.pageRow.MapID


0 Kudos