This project has moved. For the latest updates, please go here.

Is the code executing under the PTVS debugger?

Oct 2, 2014 at 11:09 AM
Is there a way to detect if the current Python code is running under the PTVS debugger?

I am using VS 2012, Python 2.7.7, and PTVS 2.1 Beta 2 VS 2012.msi.

Thank you very much for your help.
Oct 2, 2014 at 3:16 PM
There's no supported way of doing so (i.e. something that you could put in code that you ship to other people, and expect it to keep working with new releases etc).

Unofficially, you could check for the presence of PTVS debugging modules in sys.modules - print it out after the debugger is loaded, and look for entries that start with a "$".
Marked as answer by OlafMeding on 10/7/2014 at 12:40 AM
Oct 7, 2014 at 7:40 AM
Thanks much.