I'm running the visual studio code tutorial with Python and am unable to connect to the debugger. Google / SO are coming up empty when I search. Usually I use Anaconda with Jupyter, so I'm connecting Visual Studio Code to the python in my activated 3.6 virtual environment. I tried pip installing ptvsd in my virtual environment, but that did not make a difference in what I am seeing.
I would welcome any suggestions. Screenshots included below. launch.json in the bottom screenshot
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on the editor and select Debug Python File in Terminal.
Python in Visual Studio supports debugging without a project. With a stand-alone Python file open, right-click in the editor, select Start with Debugging, and Visual Studio launches the script with the global default environment (see Python environments) and no arguments.
VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.
Open the launch.json
file and add the following configuration:
{ "name": "Python: Debug Console", "type": "python", "request": "launch", "program": "${file}", "console": "internalConsole" }
When you specify none
internalConsole
for the console, it will run the debugger in the debugger console instead of running in the internal or external terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With