Pregunta

I am using Visual Studio 12 with Python Tools for Visual Studio 1.5 to develop Python programs. That works very well.

Now I would like to check within the Python code whether we are running within Visual Studio or not. Is there an easy way to achieve this?

¿Fue útil?

Solución

import sys
if '$visualstudio_py_debugger' in sys.modules:
    print("Running in Visual Studio")
else:
    print("Running outside Visual Studio")
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top