ArcPy script called from ASP.net Service ERROR (Python3). Not Signed into Portal

379
1
02-05-2020 06:33 PM
by Anonymous User
Not applicable

Hi all,

Any help would be much appreciated...... Shane Buscher & Arne Gelfert

When attempting to run a python 3 script, that imports arcpy, from an asp.net service, I am receiving the following runtime error:

 File "C:\UploadWindsCurrents.py", line 13, in <module>
import arcpy
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 74, 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 1, in <module>
from ._arcgisscripting import *
RuntimeError: Not signed into Portal.

The script runs fine when I run it through command prompt, either specifying the propy.bat or the python3 interpreter.

 eg: "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy.bat" C:\UploadWindsCurrents.py scenario currentsdir windsdir

I understand that when running a python script in the 3.x when importing arcpy it verifies that the install of ArcGIS Pro is licensed.

Based on other articles I have tried the following with no success...

  1. Licensed ArcGIS Pro for offline use
  2. Ensured that the asp.net service is running under the same account that ArcGIS pro is installed and licensed

 

references:

ArcPy fails to import when not logged into host machine 

Avoiding arcgisscripting RuntimeError: Not signed into Portal from ArcPy with ArcGIS Pro? - Geograph... 

 

Thanks 

James

 

As a note, I have successfully run a 2.x python script from the asp.net service so the issue is definitely with python 3.x and obtaining a license.

0 Kudos
1 Reply
Arne_Gelfert
Regular Contributor

I think you might have to actually run Pro once as the user that will run your script. I remember something like that I had to do recently. 

0 Kudos