import sys
if '$visualstudio_py_debugger' in sys.modules:
print("Running in Visual Studio")
else:
print("Running outside Visual Studio")
How to check if Python program has been started in Visual Studio?
-
06-03-2022 - |
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?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow