Is there an environment parameter or attribute that can be accessed from within a Notebook in order to reliably determine if it is being run in ArcGIS Online or in ArcGIS Pro?
We are finding that we often have Notebooks we want to use in both environments. Rather than having to edit the GIS connection info depending on where it is being run, we would like it to figure that out on its own. If it is running in Pro, then use GIS('pro'), and if it is running in ArcGIS Online, then use GIS('home').
For now, we are making that assumption that the Notebook environment's HOMEPATH is r'/home/arcgis' when it is being run in ArcGIS Online. If is being run in ArcGIS Pro, then it will have some other value; it being highly unlikely that someone has installed it on their own machine in "/home/arcgis", especially on a Windows machine.
For example:
homepath = %env HOMEPATH
if( homepath == r'/home/arcgis' 😞
print( "ArcGIS Online Notebook" )
gis = GIS('home')
else:
print( "Local Notebook" )
gis = GIS('pro')
It would be nice to have something that is well-known and authoritative to use instead though, so that we could rely on it in the long-run.