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

18940
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. 

79 Replies
ShelbyZelonisRoberson
Frequent Contributor

Thank you! I feel much less crazy now because I thought that bug was fixed in 2.0 but apparently not. Please keep us posted. 

0 Kudos
JeffMoulds
Esri Contributor

We have fixed the two aforementioned bugs in the 2.0.1 patch (BUG-000106659 and BUG-000106464) which should be available approx mid August.

ShelbyZelonisRoberson
Frequent Contributor

For anyone interested... a patch was released this week for Pro (2.0.1) and it includes the fix for this bug. I tested it and it works! Thanks to all who tried to help solve the issue.

Release notes for ArcGIS Pro 2.0—ArcGIS Pro | ArcGIS Desktop 

mpboyle
Frequent Contributor

Can confirm this now works. Switched around the settings of my task in Scheduler, logged off the server, and the task ran as expected.

ThomasColson
MVP Frequent Contributor

This doesn't appear to have been fixed at 2.0.1 unless the "patch" is a separate download. The following runs fine as a logged in user, but fails when run as other user -> service account. The same service account has been successfully triggering 2.7 scripts for years, so it's not an OS permission issue. Never had any of these required to be authenticated to a Portal issues with 2.7, it's not clear why authentication to a Portal is required in 3.5.3 just to import a library.

C:\Users\sasquatch>"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\p
ython.exe" C:\PRODUCTION\GRSM_DISTURBANCE\DISTURBANCE\Maps\ArcGIS\UPDATE_GRSM_DI
STURBANCE_PRO.py
Traceback (most recent call last):
  File "C:\PRODUCTION\GRSM_DISTURBANCE\DISTURBANCE\Maps\ArcGIS\UPDATE_GRSM_DISTU
RBANCE_PRO.py", line 1, in <module>
    import arcpy
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 66,
 in <module>
    from arcpy.geoprocessing import gp
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__
.py", line 14, in <module>
    from ._base import *
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py
", line 14, in <module>
    import arcgisscripting
RuntimeError: Not signed into Portal.

0 Kudos
curtvprice
MVP Esteemed Contributor

How is is this process accessing a license? 2.7 is licensed through single-use or concurrent use, Pro's licensing is either through Portal, AGOL, or a separate (from "10x") single-use or concurrent-use setup.

0 Kudos
ThomasColson
MVP Frequent Contributor

0 Kudos
curtvprice
MVP Esteemed Contributor

I would contact Esri support. I'm not sure concurrent use for Pro supports check-out (maybe through ArcGIS Administrator though?)

0 Kudos
ShelbyZelonisRoberson
Frequent Contributor

I use concurrent use Pro with my script no problem. The one difference between mine and yours is I do not have my Pro set to work offline. If you have taken your Pro offline I can certainly see how that could be an issue.

Ever since 2.0.1 this process has worked seamlessly for me. I would definitely suggest contacting Esri tech support if putting your Pro back online doesn't fix the problem. 

ShelbyZelonisRoberson
Frequent Contributor

All -- this stopped working for me when I upgraded my Pro two weeks ago to the production version of 2.1 (and subsequent 2.1.1). My script no longer runs when I am not logged in. Oddly, it worked fine in the Beta of 2.1. Are any of you having similar issues? Thanks.