Select to view content in your preferred language

Mapseries losing connection

828
2
02-08-2021 11:45 AM
EvanLafford1
Emerging Contributor

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
C:\folderpath\_StupidMan123.pdf
Exporting page to Georeferenced PDF for StupidMan123


2 (print PageNum)
1 (print ms.PageCount)
Traceback (most recent call last):
  File "C:\folderpath\MXDddpTest.py", line 49, in <module>
    ms.currentPageNumber = pageNum
  File "C:\folderpath\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\_base.py", 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
Kara_Shindle
Frequent Contributor

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

0 Kudos
EvanLafford1
Emerging Contributor

Here's the functional part of it

 

mxd = arcpy.mp.ArcGISProject(r"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):
    print(pageNum)
    print(ms.pageCount)
    ms.currentPageNumber = pageNum
    MapID = ms.pageRow.MapID

 

0 Kudos