I am working on converting a python script from 2 to 3. I am having issue with figuring out an error related to map series "getPageNumberFromName".
Below is the Python 3 conversion for map series.
ms = lyt.mapSeries
lyt.mapSeries.refresh()
pageNumber = ms.getPageNumberFromName(PIN)
ms.currentPageNumber = pageNumber
Here is the setup for (PIN)
cursor = arcpy.SearchCursor(SourceTable)
for i in cursor:
try:
print('Start time: ' + strftime('%H:%M:%S') +'\n')
PIN = i.getValue(SearchField)
NoQuotePIN = i.getValue(SearchField)
print('\tAnalyzing parcel PIN ' + NoQuotePIN + ' ...')
#Reference aprx and layers
aprx = arcpy.mp.ArcGISProject(r'....ProMigration\AgMap_Pro.aprx')
m = aprx.listMaps("AgMap")[0]
ParcelLayer = m.listLayers("Parcel*")[0]
AgUseLayer = m.listLayers("AgUse*")[0]
SoilLayer = m.listLayers("Soil*")[0]
Also in my script reference lyt = aprx.listLayouts()[0] before map series section.
Below here is the python 2 script for data driven page. The PIN is the same exact setup but references python 2.
ddp = mxd.dataDrivenPages
ddp.refresh()
ddp.currentPageID = ddp.getPageIDFromName(PIN)
Below is the error I get when I run the script. What confuses me is the ValueError is the exact PIN that is being referenced within script.
Any ideas on what the issue is?
Solved! Go to Solution.
Issue Resolved - Unsure if it's a workaround or not, but anyway...
within my layout in Pro, I did the steps below and instead of selecting "none" I selected the field PIN referenced and that worked. Screenshot below is from bug-000136946
Issue Resolved - Unsure if it's a workaround or not, but anyway...
within my layout in Pro, I did the steps below and instead of selecting "none" I selected the field PIN referenced and that worked. Screenshot below is from bug-000136946