Select to view content in your preferred language

ArcGIS Pro Runtime Error: the product license has not been initialized

27556
33
Jump to solution
02-03-2021 10:44 AM
chintakandel
New Contributor III

I've issue license initialization in ArcGIS Pro 2.7. I can run python script manually via command line and batch file but encountered with following run time error with scheduled task in Windows server 2019. 

File "C:\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
File "C:\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgisscripting\__init__.py", line 128, in <module>
from ._arcgisscripting import *
RuntimeError: The Product License has not been initialized.

Any ideas or solutions?

Thanks in advance,

Chintamani

33 Replies
feralcatcolonist
New Contributor III

I've used this process in the past to trick ArcGIS Pro into thinking that I've manually logged in to keep resetting the counter that requires a manual sign-in process.

import os
import time

#Assign the location on the machine, usually here
ArcGIS_Pro_filepath = r"C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe"
#Use os.startfile(), this will launch ArcPro
os.startfile(ArcGIS_Pro_filepath)
#Use time.sleep() to wait 60 seconds, enough time for ArcPro to open properly
time.sleep(60)
#Use os.system() to forcefully quit named process, ArcGISPro.exe
#https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill
os.system("taskkill /f /im ArcGISPro.exe")
#You can use the following output to determine if the command was successful
#SUCCESS: The process "ArcGISPro.exe with PID 4408 has been terminated

https://gist.github.com/FeralCatColonist/9cae407c7200fa6a45f922c019e397c3

jschuckert
New Contributor III

@feralcatcolonist if you are say using a service account which is what runs all your automation but is rarely logged in with, does this truly keep the ArcGIS Pro login tokens active (or renewed)? A recent ESRI Tech support case we flushed out that their (ESRI's) recommended batch file to launch Pro only works from Task Scheduler if "Run only when user is logged on" is checked. If you use the alternative "Run whether user is logged on or not", it still runs error free however does not make the token refresh calls thus keeping the login active for another 14 days. 

0 Kudos
Shovon
by
New Contributor

Please follow the instructions 

Python in ArcGIS Pro—ArcGIS Pro | Documentation

Authorize Python outside the application
If you run Python scripts that use ArcGIS Pro functionality outside of the ArcGIS Pro application, such as a Python IDE, from a command prompt, or running scripts through scheduled tasks, one of the following conditions must be met:

1.Sign me in automatically is checked when signing in to ArcGIS Pro.
2.ArcGIS Pro is currently open.
3.ArcGIS Pro has been authorized to work offline.
4.ArcGIS Pro is configured with a Concurrent Use license and at least one license is available on the ArcGIS License Manager.

erinheinrich
New Contributor III

Option 4 does not work for me, I have use single use licence, concurrent just not working as expected.

0 Kudos