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
import arcpy
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 66, in
from arcpy.geoprocessing import gp
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in
from ._base import *
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in
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.
Answer
As you're licensed ArcGIS Pro from portal/online, I suspect you have not "authorized ArcGIS Pro to work offline" (an option available in the backstage).
I bring this up, as the error you're getting, about not being signed in, is most likely due to the session expiring or not being able to refresh itself. Python does not have a direct way to authenticate to the portal to license Pro. It relies on Pro to be licensed. (And you authenticate your license when using a named user by signing into the portal via the popup box)
So what to do? Like I said, you can authorize Pro to work offline from the backstage. Otherwise if you encounter this error you'll need to open Pro and "refresh" your connection to the license.
Note - being logged into arcgis.com via a browser has absolutely nothing to do with licensing Pro. You might be using the same account, but being logged in there does not authenticate ArcGIS Pro.
This may not answer your question specifically. It answers the generic "I get an error about not being logged in when running my stand alone script". You've stated:
I am running my script while ArcGIS Pro is open
....because of that, I can't explain why you'd receive the error.
No comments:
Post a Comment