HI, I am looking for the best practice way to make my script run in ArcGIS Pro and Exterprise portal without modification - specifically getting the gis().
The user will be already logged in and have an active portal before running the script.
At the moment I use gis("home") when using portal and gis("Pro") when using Arc Pro
is there a test I can use to determine whether the script is running in in Pro or Portal so I can choose?
Alternatively, is there a different approach I should be using?
I think this could work by putting the two login methods in a try-except statement.
Something like this:
try: # first attempt to login using notebook specific home gis = GIS("home") except: # otherwise login using active portal in pro gis = GIS("pro")
I'm pretty sure running GIS("home") outside of ArcGIS Notebooks will throw up an error, allowing this switch to work.
Thanks, I'll give this a go