Sometimes when I run a Python script from IDLE that uses the ArcPy installed with ArcGIS Pro 1.4.1 the script will abort with RuntimeError: Not signed into Portal
:
RESTART: C:\temp\test.py
Traceback (most recent call last):
File "C:\temp\test.py", line 9, 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.
If I do nothing other than run the script again, in exactly the same way, using the same Python shell and script windows, then it will usually just work. Very occasionally I may have to try running it a third time. At a very rough estimate it works 90% first time, 9% second time and 1% third time.
I have seen the same error on two machines running two versions and two different license sources:
- ArcGIS Pro 1.4.1 sourcing its license from ArcGIS for Portal
- ArcGIS Pro 1.3.1 sourcing its license from ArcGIS Online
In both configurations I have not tested using Authorize ArcGIS Pro to work offline
so all tests have been run while working online.
Does anyone know a likely cause for this error, and any way to try and avoid it occurring?
The same error seems to have been seen deep in a GeoNet forum thread and suggests that it is related to logging out of ArcGIS Online while running the script. However, I am running my script while ArcGIS Pro is open (but not being used), and I am not logged in via a browser to ArcGIS.com
so I think the advice offered there does not apply.