<?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: Scripts with .exportToPDF() lock up Windows Task Scheduler in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1249456#M66589</link>
    <description>&lt;P&gt;Just wanted to add my solution in case it may help someone, although I can't confirm this is the same problem Peter had.&lt;/P&gt;&lt;P&gt;This behavior was only occurring when Windows Task Scheduler was configured to&amp;nbsp;&lt;SPAN&gt;"Run whether user is logged on or not".&amp;nbsp; Changing this setting to "Run only when user is logged on" allowed the scripts to execute to completion.&amp;nbsp; The service account executing the scripts/tasks should then never be logged off.&amp;nbsp; The service account should also be configured to log in automatically in the case of a server reboot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Less than ideal, but it has been working in our environment.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 14:24:01 GMT</pubDate>
    <dc:creator>Marshal</dc:creator>
    <dc:date>2023-01-19T14:24:01Z</dc:date>
    <item>
      <title>Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093852#M62199</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I have noticed an issue with our scripts that have exportToPDF functions (reports and maps). Basically if one of these scripts is run in a task, subsequent scripts do not execute, the export to pdf script does execute and then 'hangs' the task as 'Running'. I have tried putting quit() at the end, but it did not resolve the issue. Any other tips to force close a script after it has run, or clear memory...? Has anyone else experienced such behavior?&lt;/P&gt;&lt;P&gt;In the past, we have had these scripts run perfectly in task scheduler, weird that is has just happened now.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 23:13:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093852#M62199</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-08-30T23:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093860#M62200</link>
      <description>&lt;P&gt;I haven't tested in task scheduler, but in a recent script where I was using the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/pdfdocumentcreate.htm" target="_self"&gt;PDFDocumentCreate&lt;/A&gt; class, ensuring that I delete&amp;nbsp;the objects at the end was in their code samples.&amp;nbsp;This is also required for working with data in GDAL python, not sure if it's a similar reason (C++ bindings or something like that).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# ArcGIS project, maps and pdf document objects
del aprx, maps, pdf&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 23:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093860#M62200</guid>
      <dc:creator>nzjs</dc:creator>
      <dc:date>2021-08-30T23:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093862#M62201</link>
      <description>&lt;P&gt;thanks for the advice, have tried it, not successfully unfortunately.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 23:44:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093862#M62201</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-08-30T23:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093866#M62202</link>
      <description>&lt;P&gt;There are a couple of "Related" threads to the right of your post, for example...&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/script-using-python-api-and-windows-task-scheduler/m-p/1067011#M61326" target="_blank"&gt;Solved: Re: Script using Python API and Windows task sched... - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;none of those apply?&lt;/P&gt;&lt;P&gt;Are you opening files and the like or using processes that can be controlled by python's context manager?&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/3/library/contextlib.html" target="_blank"&gt;contextlib — Utilities for with-statement contexts — Python 3.9.6 documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 00:27:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1093866#M62202</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-31T00:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1228957#M66031</link>
      <description>&lt;P&gt;Any chance you found a solution to this?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 23:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1228957#M66031</guid>
      <dc:creator>Marshal</dc:creator>
      <dc:date>2022-11-04T23:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1249456#M66589</link>
      <description>&lt;P&gt;Just wanted to add my solution in case it may help someone, although I can't confirm this is the same problem Peter had.&lt;/P&gt;&lt;P&gt;This behavior was only occurring when Windows Task Scheduler was configured to&amp;nbsp;&lt;SPAN&gt;"Run whether user is logged on or not".&amp;nbsp; Changing this setting to "Run only when user is logged on" allowed the scripts to execute to completion.&amp;nbsp; The service account executing the scripts/tasks should then never be logged off.&amp;nbsp; The service account should also be configured to log in automatically in the case of a server reboot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Less than ideal, but it has been working in our environment.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 14:24:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1249456#M66589</guid>
      <dc:creator>Marshal</dc:creator>
      <dc:date>2023-01-19T14:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Scripts with .exportToPDF() lock up Windows Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1325139#M68524</link>
      <description>&lt;P&gt;Hi Marshal,&lt;/P&gt;&lt;P&gt;Thanks for you tips, i have tested this and it works! I had be juggling the scrip order and running them in multiple tasks. Hopefully we can get notebook server running on our enterprise soon so we can ditch task scheduler.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 01:36:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripts-with-exporttopdf-lock-up-windows-task/m-p/1325139#M68524</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2023-09-04T01:36:39Z</dc:date>
    </item>
  </channel>
</rss>

