bmerson

how to identify context script is running in

Discussion created by bmerson on Jun 7, 2011
Latest reply on Jun 8, 2011 by lpugh01
Is there some way to determine the context a script is running in?  That is, can I tell that the script is being run standalone or within a "tool" (or, perhaps better, in ArcMap or ArcCatalog)?

Based on the docs, I thought that AddMessage etc. might throw an exception in standalone mode, but that does not seem to be the case.  The functions appear to have been written (correctly, in my opinion) to simply do a print in that situation.  However, in order to do this reasonably, I think they must be doing such a test internally.  I'm wondering what that test is and can I do it in my scripts.  Any ideas will be appreciated.

Outcomes