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
Solved! Go to Solution.
This worked great! Thanks.
Our configuration is different than any other helpful threads - here is our config and solution.
Config: We have a dedicated scripting server (WS 2016); default Pro 2.9.1 install; custom cloned environment in "C:\Python3x\...\our_clone"; scripts on local and network drives; tasks run as a domain\service account that we cannot use as machine login; concurrent license
Solution:
Our biggest problem was initializing the Arc license, which was due to the service account and Pro relationship. Several threads mention logging in as the Scheduled Task user, but that was not possible for us. I often Run As Admin, but had forgotten about the option to log into the application as the service account.
Other Attempts:
Hi RickMomsen1,
I'm facing a similar issue and your setup sounds similar to ours. It's a server machine that needs to trigger some Python scripts.
But I'm not sure what you mean by "service account". Does that require a special kind of license?
We’re using service account as admin account. Ignore service account if you are using admin account for your computer.
Hi, Thank you for posting this information. I tried to follow this procedure, but perhaps when you said "Task Manager", you meant "Task Scheduler"? The Task Manager doesn't have an Action option, but the Scheduler does. It looks like this solution will not work for me, as I'm not triggering the script through a scheduled task.
Thanks, our IT is setting up such an account. I hope it works. I'll post again either way.
Though related, my target functionality is a bit different from what is posted here. I'm not triggering the run from a Task Manager. It's triggered by PHP code. I can't figure out what the equivalent of setting the task manager's privileges would be.
I think you have to run Task Manager as administrator or service account to access system tools. You may require to run ArcGIS Pro as admin.
Hi Chintakandel,
I can run as administrator. Can you tell me which system tools are involved?
I am suffering from the same behavior:
File ".\Arcpy\PublishService.py", line 9, in <module>
import arcpy
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 88, 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
File "C:\Program Files\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.
the characteristics of my environment:
ArcGIS pro 2.9.3
ArcGIS Pro Named User License
The processes were running with out issue, but since yesterday it start with this issue, as it can be seen in the code above, the error is triggered when the script reach the import arcpy command.
An special consideration: I have a set of 5-6 scripts that runs over 4 geodatabases, all of them are orchestrated to be run sequentially by a service (the service runs under the same credentials as the ArcGIS Pro application was configured and executed - you know...the profile cookie mentioned above), but not all the scripts fail, and the failing ones are not always the same.
I even have a script made in PowerShell that uses the ArcGIS.Core.Hosting.dll, it is failing too when the initialization is called.