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

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.


You could try using "propy.bat" or "proenv.bat".

One loads environments for stand-alone scripts and the other loads the environment for an interactive session.

http://pro.arcgis.com/en/pro-app/arcpy/get-started/using-conda-with-arcgis-pro.htm


I had this same error, and was able to resolve it with the help of the above 2 answers. I used propy.bat as my python executable, and I ran it in an administrator shell. Apparently the sign-in portal validation with arcpy needs to happen with administrator elevation.