<?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 Re: ExportToPDF with arcpy fails in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594237#M93854</link>
    <description>&lt;P&gt;Does it cause the script to hang?&amp;nbsp; Interesting that it behaves differently on Windows Server vs. Windows 11.&amp;nbsp; I encountered similar behavior on our Windows Server 2019 box.&amp;nbsp; The only solution I found at the time was using "Run only when user is logged on" and making sure the account was always logged on.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093852" target="_blank"&gt;https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093852&lt;/A&gt;&lt;/P&gt;&lt;P&gt;That said, I just did some testing on ArcGIS Pro 3.4 (Windows Server 2019, only ArcGIS installed) after a recent upgrade and it seems to work using "Run whether user is logged on or not".&amp;nbsp; I will try to conduct further testing over next couple weeks and report back.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Mar 2025 13:54:51 GMT</pubDate>
    <dc:creator>Marshal</dc:creator>
    <dc:date>2025-03-11T13:54:51Z</dc:date>
    <item>
      <title>ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594183#M93849</link>
      <description>&lt;P&gt;I have a pythonscript that exports pdf with arcpy.exportToPDF.&lt;/P&gt;&lt;P&gt;It has worked well until december 2024/january 2025.&lt;/P&gt;&lt;P&gt;It works on my machine (with Windows 11) in Windows scheduler (with option: Run whether user is logged in or not). (I have a runner.bat that runs a pythonfile.)&lt;/P&gt;&lt;P&gt;But it does not work on a Windows Server (We&amp;nbsp;have upgraded from Windows Server 2019 to 2022 but it did&amp;nbsp;not make any difference).&lt;/P&gt;&lt;P&gt;On this Windows server&amp;nbsp;it only works to run when i run it right in the commandtool, or in a windows task scheduler with the option: Run only when the user is logged on.&lt;/P&gt;&lt;P&gt;I have tried with ArcGIS Server on the server, and also tried with only ArcGISPro (3.3) on the server. Both with&amp;nbsp;MicrosoftEdgeWebView2RuntimeInstallerX64 installed (test is done with version 133.0.3065.92 and 134.0.3124.51).&lt;/P&gt;&lt;P&gt;I also tried with a older version of ArcGISPro.&lt;/P&gt;&lt;P&gt;I have all admin permissions on the folders and in task scheduler.&lt;/P&gt;&lt;P&gt;So, the question is what can cause this arcpy.exportToPDF to fail? and without any errormessages.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 13:06:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594183#M93849</guid>
      <dc:creator>Dalneberg</dc:creator>
      <dc:date>2025-03-11T13:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594237#M93854</link>
      <description>&lt;P&gt;Does it cause the script to hang?&amp;nbsp; Interesting that it behaves differently on Windows Server vs. Windows 11.&amp;nbsp; I encountered similar behavior on our Windows Server 2019 box.&amp;nbsp; The only solution I found at the time was using "Run only when user is logged on" and making sure the account was always logged on.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093852" target="_blank"&gt;https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093852&lt;/A&gt;&lt;/P&gt;&lt;P&gt;That said, I just did some testing on ArcGIS Pro 3.4 (Windows Server 2019, only ArcGIS installed) after a recent upgrade and it seems to work using "Run whether user is logged on or not".&amp;nbsp; I will try to conduct further testing over next couple weeks and report back.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 13:54:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594237#M93854</guid>
      <dc:creator>Marshal</dc:creator>
      <dc:date>2025-03-11T13:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594262#M93861</link>
      <description>&lt;P&gt;Hi, thanks, no it does not cause the script to hang, it just stop and without any errors.&amp;nbsp;&lt;BR /&gt;Ok, i will test to install ArcGISPro 3.4 on a windows server and see if it works with that.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 14:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594262#M93861</guid>
      <dc:creator>Dalneberg</dc:creator>
      <dc:date>2025-03-11T14:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594487#M93890</link>
      <description>&lt;P&gt;Mapped drive locations can be an issue with scheduler, as they're profile-specific.&amp;nbsp; Your service principal may not have those mappings or arcpy library, or may still be some gpo issue when the box logs in as you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd be tempted to output somewhere simple such as the C:\ or a UNC path.&lt;/P&gt;&lt;P&gt;Work the problem up from writing a text file with no modules imported, then something basic in arcpy etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 20:43:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1594487#M93890</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-03-11T20:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1595048#M93946</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I do not use mapped drive locations, only on C:\&lt;BR /&gt;I also have tested to work the problem up, and it always stop at the arcpy.exportToPDF, not at the&amp;nbsp;arcpy.mp.ArcGISProject for example.&lt;BR /&gt;&lt;BR /&gt;My python-script:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import arcpy, os&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def main():&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"1")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;# Ange sökvägar&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;prjPath = os.path.normpath(r'C:\temp\fme')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;outputPath = os.path.normpath(r'C:\temp\fme\testoutput')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"2")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;path = os.path.join(prjPath, 'Test_PDFutskrift.aprx')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"2.1")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Öppna ArcGIS Pro-projektet&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;p = arcpy.mp.ArcGISProject(path)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"3")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Lista av layoutnamn&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;layoutNames = ['A3', 'A2']&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;for name in layoutNames:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;# Hämta layout&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"4")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;layouts = p.listLayouts(name)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;if len(layouts) == 0:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"Layout {name} finns inte i projektet.")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;continue&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;lyt = layouts[0]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Sökväg för PDF-export&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;pdfPath = os.path.join(outputPath, f"{name}.pdf")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"Försöker exportera {name} till {pdfPath}...")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Exportera till PDF&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;try:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;lyt.exportToPDF(pdfPath)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"Lyckades exportera {name} till {pdfPath}.")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;except Exception as e:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(f"Misslyckades med att exportera {name} till PDF: {e}")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if __name__ == "__main__":&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;main()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 07:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1595048#M93946</guid>
      <dc:creator>Dalneberg</dc:creator>
      <dc:date>2025-03-13T07:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1595431#M93984</link>
      <description>&lt;P&gt;Yes I suggested it really to test that the script can write/output something.&amp;nbsp; If that works, then it then likely excludes any write issues/file and folder permission issues etc.&amp;nbsp; I'd still suggest trying to output a textfile.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 21:18:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1595431#M93984</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-03-13T21:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1595506#M93991</link>
      <description>&lt;P&gt;Yes, I can write a textfile, and all above the code down to exportToPDF, there it stops without any errors.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 06:59:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1595506#M93991</guid>
      <dc:creator>Dalneberg</dc:creator>
      <dc:date>2025-03-14T06:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1597263#M94173</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/889449"&gt;@Dalneberg&lt;/a&gt;&amp;nbsp;I have this exact same issue!! For me I had a production script running for well over a year then around the Dec 1st run of the process started failing but only for the pdf export step and only when run from Task Scheduler with the option (I need) "Run whether user is logged on or not" checked.&lt;BR /&gt;&lt;BR /&gt;I have 3 servers (x2 on OS 2016 DataCenter and x1 on Server 2019) all of which I can recreate the same failing behavior.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried pointing the PDF output to the local C Drive which the service account running the script has full permissions on. I also tried older versions of Pro. None of that made a difference.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I opened an ESRI case, however it is now since closed as they were unable to reproduce the behavior and deemed it something network specific to my environment.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have been troubleshooting this ever since with no success!! This is a tricky one...&lt;BR /&gt;&lt;BR /&gt;The best I could find was old ESRI bugs that were very similar, however those have since been resolved. Since ESRI was not able to recreate the issue on their end I seem to be at a dead end.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 19:35:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1597263#M94173</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-03-19T19:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1603223#M94693</link>
      <description>&lt;P&gt;I now also had I case at ESRI, but they unfortunatley also closed it and they think the problem is in windows and probably has do with some permission in some kind. So now I have a errand on our IT department, hopeful they will find a solution.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 11:02:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1603223#M94693</guid>
      <dc:creator>Dalneberg</dc:creator>
      <dc:date>2025-04-07T11:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1603857#M94758</link>
      <description>&lt;P&gt;Interesting. We both seem to be stuck in the same loop. Still no solution on my end either...&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 17:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1603857#M94758</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-04-08T17:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1611232#M95464</link>
      <description>&lt;P&gt;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 also 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" &lt;SPAN&gt;when running the task.&lt;/SPAN&gt;&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:47:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1611232#M95464</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-05-02T18:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1618797#M96111</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/527269"&gt;@jschuckert&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Hi, this problem is now solved in our enviroment! i.e. exporting pdf with arcpy via task scheduler and then also via FME Flow, works again!&lt;/P&gt;&lt;P&gt;It started working on 20/5 after our IT installed the month's windows patches on the entire production environment, they also updated vmware tools in connection with that. Now it is vmware version 12.5.2. The guy at IT is unsure what version it was before.&lt;/P&gt;&lt;P&gt;I have not received any confirmation what made this particular thing start working again, it would have been interesting to know.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 09:07:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1618797#M96111</guid>
      <dc:creator>Dalneberg</dc:creator>
      <dc:date>2025-05-28T09:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: ExportToPDF with arcpy fails</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1620525#M96295</link>
      <description>&lt;P&gt;Thanks for the update&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/889449"&gt;@Dalneberg&lt;/a&gt;&amp;nbsp;. That is at least somewhat hopeful and good to hear in your case.&lt;BR /&gt;&lt;BR /&gt;I just tested and it is unfortunately still broken in our environment. That said, I am unsure what updates we have available for our various servers. I am hoping we have some ready to be applied for some before/after testing.&lt;BR /&gt;&lt;BR /&gt;You are on&amp;nbsp;&lt;SPAN&gt;Windows Server 2022, correct? We are on older server OS so it is hard to say how that will play into any patch fixes.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 17:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/exporttopdf-with-arcpy-fails/m-p/1620525#M96295</guid>
      <dc:creator>jschuckert</dc:creator>
      <dc:date>2025-06-03T17:40:26Z</dc:date>
    </item>
  </channel>
</rss>

