Question

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?

Était-ce utile?

La solution

import sys
if '$visualstudio_py_debugger' in sys.modules:
    print("Running in Visual Studio")
else:
    print("Running outside Visual Studio")
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top