0

When running scripts that import arcpy, i receive:

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), 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.

3
  • The first thing that comes to mind is to check whether the user/account running the script still has a Named User license assigned in either AGOL or Enterprise.
    – bixb0012
    Commented Sep 28, 2022 at 14:18
  • @bixb0012 The user has a Named User license assigned in Enterprise. the funny part is that some of the scripts are failing during the execution. Are not always the same.
    – XtianGIS
    Commented Sep 29, 2022 at 6:35
  • You have to start ArcGIS Pro every n weeks or it will log out.
    – Bera
    Commented Apr 25, 2023 at 10:19

1 Answer 1

0

I had the same problem. On my computer I have 2 users. Admin and MyName. All the programs and scripts I worked with as user "MyName".

When I once executed a script from the command line (opened as Admin) I got the same error like you. The solution was to open the command line as user MyName and execute the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.