<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Map Series getPageNumberFromName Error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/map-series-getpagenumberfromname-error/m-p/1319126#M68426</link>
    <description>&lt;P&gt;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".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the Python 3 conversion for map series.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ms = lyt.mapSeries&lt;BR /&gt;lyt.mapSeries.refresh()&lt;BR /&gt;pageNumber = ms.getPageNumberFromName(PIN)&lt;BR /&gt;ms.currentPageNumber = pageNumber&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Here is the setup for (PIN)&lt;/P&gt;&lt;PRE&gt;cursor = arcpy.SearchCursor(SourceTable)&lt;BR /&gt;&lt;BR /&gt;for i in cursor:&lt;BR /&gt;try:&lt;BR /&gt;print('Start time: ' + strftime('%H:%M:%S') +'\n')&lt;BR /&gt;PIN = i.getValue(SearchField)&lt;BR /&gt;NoQuotePIN = i.getValue(SearchField)&lt;BR /&gt;print('\tAnalyzing parcel PIN ' + NoQuotePIN + ' ...')&lt;BR /&gt;&lt;BR /&gt;#Reference aprx and layers&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject(r'....ProMigration\AgMap_Pro.aprx')&lt;BR /&gt;m = aprx.listMaps("AgMap")[0]&lt;BR /&gt;&lt;BR /&gt;ParcelLayer = m.listLayers("Parcel*")[0]&lt;BR /&gt;AgUseLayer = m.listLayers("AgUse*")[0]&lt;BR /&gt;SoilLayer = m.listLayers("Soil*")[0] &lt;/PRE&gt;&lt;P&gt;Also in my script reference&amp;nbsp;&amp;nbsp;lyt = aprx.listLayouts()[0] before map series section.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below here is the python 2 script for data driven page. The PIN is the same exact setup but references python 2.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ddp = mxd.dataDrivenPages&lt;BR /&gt;ddp.refresh()&lt;BR /&gt;ddp.currentPageID = ddp.getPageIDFromName(PIN)&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Any ideas on what the issue is?&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78222iE4FB7B8C8298C0FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error.PNG" alt="Error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 11:13:08 GMT</pubDate>
    <dc:creator>ScoutStanley</dc:creator>
    <dc:date>2023-08-22T11:13:08Z</dc:date>
    <item>
      <title>Map Series getPageNumberFromName Error</title>
      <link>https://community.esri.com/t5/python-questions/map-series-getpagenumberfromname-error/m-p/1319126#M68426</link>
      <description>&lt;P&gt;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".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the Python 3 conversion for map series.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ms = lyt.mapSeries&lt;BR /&gt;lyt.mapSeries.refresh()&lt;BR /&gt;pageNumber = ms.getPageNumberFromName(PIN)&lt;BR /&gt;ms.currentPageNumber = pageNumber&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Here is the setup for (PIN)&lt;/P&gt;&lt;PRE&gt;cursor = arcpy.SearchCursor(SourceTable)&lt;BR /&gt;&lt;BR /&gt;for i in cursor:&lt;BR /&gt;try:&lt;BR /&gt;print('Start time: ' + strftime('%H:%M:%S') +'\n')&lt;BR /&gt;PIN = i.getValue(SearchField)&lt;BR /&gt;NoQuotePIN = i.getValue(SearchField)&lt;BR /&gt;print('\tAnalyzing parcel PIN ' + NoQuotePIN + ' ...')&lt;BR /&gt;&lt;BR /&gt;#Reference aprx and layers&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject(r'....ProMigration\AgMap_Pro.aprx')&lt;BR /&gt;m = aprx.listMaps("AgMap")[0]&lt;BR /&gt;&lt;BR /&gt;ParcelLayer = m.listLayers("Parcel*")[0]&lt;BR /&gt;AgUseLayer = m.listLayers("AgUse*")[0]&lt;BR /&gt;SoilLayer = m.listLayers("Soil*")[0] &lt;/PRE&gt;&lt;P&gt;Also in my script reference&amp;nbsp;&amp;nbsp;lyt = aprx.listLayouts()[0] before map series section.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below here is the python 2 script for data driven page. The PIN is the same exact setup but references python 2.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ddp = mxd.dataDrivenPages&lt;BR /&gt;ddp.refresh()&lt;BR /&gt;ddp.currentPageID = ddp.getPageIDFromName(PIN)&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Any ideas on what the issue is?&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78222iE4FB7B8C8298C0FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error.PNG" alt="Error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 11:13:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-series-getpagenumberfromname-error/m-p/1319126#M68426</guid>
      <dc:creator>ScoutStanley</dc:creator>
      <dc:date>2023-08-22T11:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Map Series getPageNumberFromName Error</title>
      <link>https://community.esri.com/t5/python-questions/map-series-getpagenumberfromname-error/m-p/1323110#M68484</link>
      <description>&lt;P&gt;Issue Resolved&amp;nbsp; - Unsure if it's a workaround or not, but anyway...&lt;/P&gt;&lt;P&gt;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 &lt;A href="https://support.esri.com/en-us/bug/the-arcpy-getpagenumberfromname-function-in-a-map-serie-bug-000136946" target="_self"&gt;bug-000136946&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ScoutStanley_0-1693247079289.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79296iFBEB6BEFF9AF1C5A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ScoutStanley_0-1693247079289.png" alt="ScoutStanley_0-1693247079289.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 18:26:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-series-getpagenumberfromname-error/m-p/1323110#M68484</guid>
      <dc:creator>ScoutStanley</dc:creator>
      <dc:date>2023-08-28T18:26:26Z</dc:date>
    </item>
  </channel>
</rss>

