Python 3.5.1 script won't run via Windows Task Scheduler when user logged off

19560
79
Jump to solution
06-23-2017 09:14 AM
ShelbyZelonisRoberson
Frequent Contributor

I have a python 3.5.1 script that uses ArcGIS Pro 1.4.1 to export some layouts to PNGs. The script runs with no problem from Windows Task Scheduler when I check the option "Run only when user is logged on", however, I really need to run the script when I am logged off.  

I'm confused because I have other Python scripts (version 2.7) that run on the same server/user account via Task Scheduler while I am logged off with no problem. I've set them up with the exact same properties as my python 3.5.1 script... the only difference is the path to the python and the fact that the other scripts use ArcMap and not ArcGIS Pro. 

Has anyone else had this issue and found a way to solve it? I've set up everything using a service account on a server with admin privileges. I have the properties in Task Scheduler set to run with the highest privileges as well. 

1 Solution

Accepted Solutions
JeffMoulds
Esri Contributor

In regards to the ArcGIS Pro issue of not being able to use the arcpy.mp Layout Class export functions (for example, exportToPDF) using the operating system's Task Scheduler when the user is logged off of the Windows machine, we have a bug for that. The tracking number is BUG-000106659. There is also a related issue where you will see the similar behavior with Windows Services. The tracking number for that is BUG-000106464. As noted previously in this thread, the issues are not reproducible on all machines. We are currently investigating this issue. When I have more information, I will update this post.

This limitation was noted in the arcpy.mp help: http://pro.arcgis.com/en/pro-app/arcpy/mapping/guidelines-for-arcpy-mapping.htm. Scroll to the bottom of the help topic to the section entitled "Run Scripts as Scheduled Tasks".

View solution in original post

79 Replies
MichaelVolz
Esteemed Contributor

Are you running this from a workstation or a server?  If a server, what version?

0 Kudos
ShelbyZelonisRoberson
Frequent Contributor

Server... Windows 2012 R2

0 Kudos
MichaelVolz
Esteemed Contributor

Do you have any other Pro python scripts setup that you can test through the Task Scheduler to see if it is a specific python script issue or more a systematic issue with ArcPro based python scripts?

0 Kudos
ShelbyZelonisRoberson
Frequent Contributor

I did try another Pro python script and that did not work either. But, the ArcMap ones work fine. I reached out to Esri tech support but since the script runs fine in IDLE and from the Pro interface, they can't help me (it's outside the scope of support). 

0 Kudos
MichaelVolz
Esteemed Contributor

How about trying to run a bat file that calls the python script instead of calling the python script directly?  That is how my organization has our Scheduled Tasks setup.

ShelbyZelonisRoberson
Frequent Contributor

I know -- I tried that too... it works fine when I have the setting as "run when logged in", but again, not when I'm logged off. I'm perplexed!

0 Kudos
MichaelVolz
Esteemed Contributor

How are you getting your license for ArcPro (i.e. license manager or AGOL named user)?  If AGOL named user, are you staying logged into AGOL to access the license?

0 Kudos
ShelbyZelonisRoberson
Frequent Contributor

AGOL named user, and yep I have it set to stay logged in.

0 Kudos
ShelbyZelonisRoberson
Frequent Contributor

Yep, tried that.

0 Kudos