Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

can arcpy detect whether it's running in Desktop or Server?

$
0
0

I’m developing some code that I want to run both as an ArcGIS Server web service and as a standalone script. I want to be able to modify the execution slightly depending on whether it’s running as an AGS web service or as a standalone python/within Desktop.

Is there a way to detect this?

I’ve done some searching but haven’t found anything very satisfactory. I have seen arcpy.mapping.CreateGISServerConnectionFile, but this sets connections to a server as opposed to checking the current environment. I’ve also looked for information on how services are run w/in AGS (e.g., this), but I’m not really seeing anything along the lines of an arcpy.isWebService() type of function. Do I just need to check the environment (like to see if “%scratchFolder% has been set or examining something related to sys.argv)? Seems kind of an unstable solution.


Viewing all articles
Browse latest Browse all 767

Trending Articles