Scripts with .exportToPDF() lock up Windows Task Scheduler

08-30-2021 04:13 PM
New Contributor III

Hi All

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?

In the past, we have had these scripts run perfectly in task scheduler, weird that is has just happened now.

Tags (2)
0 Kudos
3 Replies
New Contributor III

I haven't tested in task scheduler, but in a recent script where I was using the PDFDocumentCreate class, ensuring that I delete the objects at the end was in their code samples. 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).


# ArcGIS project, maps and pdf document objects
del aprx, maps, pdf



0 Kudos
New Contributor III

thanks for the advice, have tried it, not successfully unfortunately.

0 Kudos
MVP Esteemed Contributor

There are a couple of "Related" threads to the right of your post, for example...

Solved: Re: Script using Python API and Windows task sched... - Esri Community

none of those apply?

Are you opening files and the like or using processes that can be controlled by python's context manager?

contextlib — Utilities for with-statement contexts — Python 3.9.6 documentation

... sort of retired...
0 Kudos