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.
Solved! Go to Solution.
I didn't change a single thing. I've had a Windows task running a python script every week for the past few months. When I updated to the production version of 2.1 two weeks ago, the task no longer runs when I'm not logged in. I think there might be two issues, possibly related, and I do have a ticket into Esri Tech Support. Here's what happened and my testing steps:
So, I'm back to my original problem (script not running as scheduled task when not logged in) but with an additional complication that my custom model also has stopped working in the script.
Again, I have a ticket into Esri tech support and I got an email from them this morning that they elevated my issue due to the complexity. Hopefully that means they might have an understanding of what is going on?
Can you repro if you right click the task in Task Scheduler > Run? You can also send me your repro case to firstname.lastname@example.org, 1.) Export the Task as an XML file, 2.) the python script (please simplify the script as much as possible, e.g. just a few lines that does something simple like export a layout to a PDF, and 3.) the BAT file used in the scheduled task, if applicable. Thanks.
Since this mentions "offline" use and Pro 2.1.1, I'm going to add this into the conversation. I'm not sure if this is 100% related, but just in case the Pro, Pro "offline" and Desktop "borrowing" is a common thread....
I'm trying to use Python 2.7 (Desktop 10.6 in my case) to import arcpy into an external Python IDE with a borrowed Desktop license(from CU license manager) and I am having issues. Seems to work fine if on the network so it can see my concurrent license. I also have Pro 2.1.1 installed.
So, not sure if it is the borrowed license, being offline, Pro 2.1.1 or Desktop 10.6. that might be causing the issue.
(note, I also installed/upgrade to MS Office 365 ...enterprise license.. atlhough I don't think that is the problem).
I have a tech support call in and they are looking into it.
the other geonet thread https://community.esri.com/message/749008-re-arcpy-import-is-really-slow-2-minutes for anyone interested.
Not hijacking this thread, just want to throw this out in case it helps solve both issues.
I'm having the same issues. Tasks ran fine for months...then suddenly stopped. The Python by itself runs fine, as does executing it via command prompt using service account credentials.
No resolution. I've tried every licensing scenario, concurrent, named user, offline. Script works perfectly every time when I run in the Py window, will not run as a scheduled task, period. Pro/Py 3.5.x does not have a bright future (none, in fact) with us if we can't run scheduled data management tasks, of which I have about 100, all of which ran perfectly as scheduled tasks in Arc/Py 2.7.x. Why take something that works and break it?
I feel your pain. Some things that seemed to get the script to at least run partially were: 1. full UNC paths to EVERYTHING, even local paths; 2. Using concurrent licensing; 3. Adding a path to the python folder location in the "Start in" box in the Actions tab of the Windows task.
Like I said, my script still failed at the export to PNG step, but it did partially run when not logged in (it ran at the specified time, imported arcpy, created a folder, and called an ArcGIS Pro project...but then it would stop before creating the exports of the layouts in the Pro project).
Thomas - have you happened to try this with Pro 2.2.1? I'm wondering if I should attempt to upgrade to see if it might have been "fixed". I'm still running Beta 2.1 because I don't want to break it.