<?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 ExportToPDF crash without error on ArcGIS Server python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501485#M70991</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I try to export a PDF with a scheduled task that runs in an arcgis server's server.&lt;/P&gt;&lt;P&gt;The ExportToPDF line of code crashes without any error with the python from ArcGIS Server, but works great with the python from ArcGIS Pro in other environments...&lt;/P&gt;&lt;P&gt;Here is a simple code test I made, it's crashing in the last line :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
aprx = arcpy.mp.ArcGISProject(r"D:\path...\exportToPDF.aprx")
m = aprx.listMaps("Map")[0]
layout ="Test"
lyt = aprx.listLayouts(layout)[0]
mf = lyt.listElements("mapframe_element", "WEBMAP_MAP_FRAME")[0]
extent = arcpy.Extent(446998.96875,  214866.71875, 446579.875, 215163.046875)
mf.camera.setExtent(extent)
m.defaultCamera = mf.camera
lyt.exportToPDF(out_pdf=r"D:\path...\out.pdf")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working with Pro 3.3&lt;/P&gt;&lt;P&gt;Not working with Server 11.3&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 09:54:53 GMT</pubDate>
    <dc:creator>PierreloupDucroix</dc:creator>
    <dc:date>2024-07-04T09:54:53Z</dc:date>
    <item>
      <title>ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501485#M70991</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I try to export a PDF with a scheduled task that runs in an arcgis server's server.&lt;/P&gt;&lt;P&gt;The ExportToPDF line of code crashes without any error with the python from ArcGIS Server, but works great with the python from ArcGIS Pro in other environments...&lt;/P&gt;&lt;P&gt;Here is a simple code test I made, it's crashing in the last line :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
aprx = arcpy.mp.ArcGISProject(r"D:\path...\exportToPDF.aprx")
m = aprx.listMaps("Map")[0]
layout ="Test"
lyt = aprx.listLayouts(layout)[0]
mf = lyt.listElements("mapframe_element", "WEBMAP_MAP_FRAME")[0]
extent = arcpy.Extent(446998.96875,  214866.71875, 446579.875, 215163.046875)
mf.camera.setExtent(extent)
m.defaultCamera = mf.camera
lyt.exportToPDF(out_pdf=r"D:\path...\out.pdf")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working with Pro 3.3&lt;/P&gt;&lt;P&gt;Not working with Server 11.3&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 09:54:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501485#M70991</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2024-07-04T09:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501580#M70994</link>
      <description>&lt;P&gt;the path exists?&amp;nbsp; (line 10) and you can write to it?&lt;/P&gt;&lt;P&gt;Same python version? and api for python version?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 15:50:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501580#M70994</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-07-04T15:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501711#M70996</link>
      <description>&lt;P&gt;Here is a screenshot with a cloned environment from Pro, version 3.11.8 and PDF is written :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PierreloupDucroix_0-1720126871105.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108865i73BDA1C2BCA3F17C/image-size/large?v=v2&amp;amp;px=999" role="button" title="PierreloupDucroix_0-1720126871105.png" alt="PierreloupDucroix_0-1720126871105.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and here with Server's python, same version and nothing happens :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PierreloupDucroix_1-1720126933401.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108868i030F1DB2BCADF1D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="PierreloupDucroix_1-1720126933401.png" alt="PierreloupDucroix_1-1720126933401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also tried&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    print("try")
    mf.exportToPDF(out_pdf=r"C:\Temp\out.pdf")
except exception as e:
    print(e)&lt;/LI-CODE&gt;&lt;P&gt;but no exception is returned&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 21:05:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501711#M70996</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2024-07-04T21:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501714#M70997</link>
      <description>&lt;P&gt;Tech Support is your best option.&lt;/P&gt;&lt;P&gt;related post&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/python-script-succeeds-in-idle-arcgis-pro-2-9-0/m-p/1359205#M69373" target="_blank"&gt;Solved: Python Script succeeds in IDLE(ArcGIS Pro 2.9.0) b... - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;so there are documented issues along this vein&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 21:33:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501714#M70997</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-07-04T21:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501715#M70998</link>
      <description>&lt;P&gt;I found the solution.&lt;/P&gt;&lt;P&gt;I tried to install ArcGIS Pro on the server to see if there was any difference, and the setup required installing Microsoft Edge WebView2 RuntimeInstaller X64.&lt;/P&gt;&lt;P&gt;Finally, it now works with the ArcGIS Server's python and I think it is the installation of the webview and not Pro that solved it.&lt;/P&gt;&lt;P&gt;I think ArcGIS Enterprise Setup should also require this webview to be installed...&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 21:36:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501715#M70998</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2024-07-04T21:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501717#M70999</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/get-started/arcgis-pro-system-requirements.htm" target="_blank"&gt;ArcGIS Pro 3.3 system requirements—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;there it is&lt;/P&gt;&lt;P&gt;WebView2 Runtime&lt;/P&gt;&lt;P&gt;Microsoft Edge WebView2 Runtime version 117 or later is required. If it is not already installed on the machine, use the Evergreen Bootstrapper or Evergreen Standalone Installer from Microsoft.&lt;/P&gt;&lt;P&gt;Note:&lt;BR /&gt;A per-machine installation (the default) of ArcGIS Pro requires a per-machine installation of WebView2 Runtime. To do this, right-click the WebView2 installer and click Run as administrator.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 21:42:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501717#M70999</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-07-04T21:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501720#M71000</link>
      <description>&lt;P&gt;Thanks, Dan,&lt;/P&gt;&lt;P&gt;WebView2 is not part of the ArcGIS Enterprise or Server requirements (&lt;A href="https://enterprise.arcgis.com/en/system-requirements/latest/windows/arcgis-server-system-requirements.htm" target="_blank"&gt;https://enterprise.arcgis.com/en/system-requirements/latest/windows/arcgis-server-system-requirements.htm&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;but I understand that any arcpy function using an APRX will need the requirements of ArcGIS Pro and not only ArcGIS Server.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 22:41:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1501720#M71000</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2024-07-04T22:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604378#M74014</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/208186"&gt;@PierreloupDucroix&lt;/a&gt;&amp;nbsp;the "solution" below indicates issues with the ArcGIS Pro version and the requirement of webview. Is there an ACTUAL solution besides leveraging ArcGIS Server's Python version? That might not work if specific libraries need to be installed like in the case of needing to leverage a cloned Pro environment or if the machine running the code does not have AGS installed.&lt;BR /&gt;&lt;BR /&gt;I have been stuck with this issue over the last 5 months with no solution. In my case, the code I have runs fine in the following 2 scenarios:&lt;/P&gt;&lt;P&gt;- Run from Python IDE&lt;/P&gt;&lt;P&gt;- Run from Task Scheduler with user logged in and using option "Run only when user is logged in" is selected&lt;BR /&gt;&lt;BR /&gt;But fails in the following scenario on the exportToPDF() line when:&lt;/P&gt;&lt;P&gt;- Run from Task Scheduler with the option I need selected "Run whether user is logged in or not"&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2025 20:29:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604378#M74014</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-04-09T20:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604404#M74015</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;did you check the "&lt;SPAN&gt;&lt;EM&gt;Run&lt;/EM&gt; with &lt;EM&gt;Highest Privileges&lt;/EM&gt;&lt;/SPAN&gt;" option ?&lt;/P&gt;&lt;P&gt;This sound more like a privilege issue than a library issue&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2025 21:31:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604404#M74015</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2025-04-09T21:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604420#M74016</link>
      <description>&lt;P&gt;To follow up on this, I did some testing. In my case, my AGS version is old and does not appear have the required Python libraries to run my code which refers to a Pro project then later runs exportToPDF(). AGS is installed and running on the same server which my automation runs, like in your case, but that appears to be a dead end for me.&lt;BR /&gt;&lt;BR /&gt;On another test server where I can recreate the same pdf export issue, I tried uninstalling Desktop Runtime and the WebView2 software but after Pro has already been installed. I wasn't sure if it would allow me, however it did. The export pdf still gives me issues. No change. It still fails in the last scenario:&lt;BR /&gt;&lt;SPAN&gt;- Run from Task Scheduler with the option I need selected "Run whether user is logged in or not"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2025 22:09:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604420#M74016</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-04-09T22:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604482#M74017</link>
      <description>&lt;P&gt;FYI I was referring to the second option below in addition to the first :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PierreloupDucroix_0-1744250970545.png" style="width: 492px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129869iC1E3155E9F925FCC/image-dimensions/492x204?v=v2" width="492" height="204" role="button" title="PierreloupDucroix_0-1744250970545.png" alt="PierreloupDucroix_0-1744250970545.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Maybe you should consider login a case to Esri support&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2025 02:10:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1604482#M74017</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2025-04-10T02:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1606117#M74039</link>
      <description>&lt;P&gt;Correct, I had both those options checked with highest privileges checked in all my tests. Then when testing, I can successfully get the script to fully run when the user is logged on and using the "Run only when user is logged on" option however once toggled to (what I need) "Run whether user is logged on or not" the script fails at the exportToPDF() line of code.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This same code had been running without issue for 1 1/2 years then started failing around late November/early December.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I did initially have an ESRI case open however it has since been closed. ESRI was not able to recreate the behavior. I can recreate it on 3 different servers in my environment.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I may reopen the case however as I have now found a few different threads related to the issue:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594183" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594183&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.safe.com/automation-13/flow-jobs-failing-on-python-script-using-exporttopdf-36967" target="_blank"&gt;https://community.safe.com/automation-13/flow-jobs-failing-on-python-script-using-exporttopdf-36967&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/208186"&gt;@PierreloupDucroix&lt;/a&gt;&amp;nbsp;, did you find a solution or use the workaround of leveraging AGS's Python environment?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 16:52:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1606117#M74039</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-04-15T16:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1606187#M74040</link>
      <description>&lt;P&gt;In my case, using AGS's python environment after installing the webview runtime did work.&lt;/P&gt;&lt;P&gt;Are you sure the Webview has been installed with elevated privileges (run installer as administrator) ?&lt;/P&gt;&lt;P&gt;Maybe you could try to run the installer as the scheduled tasks user in order to be sure it is installed for this user...&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 19:05:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1606187#M74040</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2025-04-15T19:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1606221#M74041</link>
      <description>&lt;P&gt;Interesting.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I will try re-installing to be sure, however I am pretty familiar with the installs so that should be the case (ran as admin).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;On the second test server I have available to me I installed and am testing Task Scheduler from my own admin login. So not leveraging the task scheduler (service) user account and still have the issue.&lt;/P&gt;&lt;P&gt;This has a been a hard issues to troubleshoot&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":persevering_face:"&gt;😣&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 20:11:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1606221#M74041</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-04-15T20:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF crash without error on ArcGIS Server python</title>
      <link>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1611234#M74119</link>
      <description>&lt;P&gt;I performed more troubleshooting related to the install however I am still unfortunately stuck with no resolution on this. I have been working with our IT Department and tried opening a new ESRI case however no luck in either avenue. For the new ESRI case, I provided several new links related to the issue (this page for example) but they came back stating it must be a Windows based issue per the Task Scheduler behavior when selecting "run whether use is logged in or not" when running the task.&lt;BR /&gt;&lt;BR /&gt;Has anyone found a solution to this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 18:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporttopdf-crash-without-error-on-arcgis-server/m-p/1611234#M74119</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-05-02T18:45:49Z</dc:date>
    </item>
  </channel>
</rss>

