Skip to content

Instantly share code, notes, and snippets.

@mfunk
Created October 16, 2015 17:20
Show Gist options
  • Save mfunk/a2d576c3f25d5c214b66 to your computer and use it in GitHub Desktop.
Save mfunk/a2d576c3f25d5c214b66 to your computer and use it in GitHub Desktop.
GetApplication() checks for Pro or Desktop as a Python snippet
def GetApplication():
'''Return app environment as ARCMAP, ARCGIS_PRO, OTHER'''
try:
from arcpy import mp
return "ARCGIS_PRO"
except ImportError:
try:
from arcpy import mapping
mxd = arcpy.mapping.MapDocument("CURRENT")
return "ARCMAP"
except:
return "OTHER"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment