try: mxd = arcpy.mapping.MapDocument("current") except: print "in arccatalog!"
Rather inelegant, but should accomplish what you want.try: mxd = arcpy.mapping.MapDocument("current") except: print "in arccatalog!"
# Prints "where" script is running from. (e.g. ArcMap, ArcCatalog, python, PythonWin, etc.) import os, sys, arcpy RunFrom = os.path.splitext(os.path.basename(sys.executable))[0] print RunFrom print arcpy.AddMessage(RunFrom)
You can do it like this:# Prints "where" script is running from. (e.g. ArcMap, ArcCatalog, python, PythonWin, etc.) import os, sys, arcpy RunFrom = os.path.splitext(os.path.basename(sys.executable))[0] print RunFrom print arcpy.AddMessage(RunFrom)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.