Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code Python Timeout waiting for debugger connection

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

enter image description here enter image description here

like image 907
bearcat Avatar asked Sep 23 '18 03:09

bearcat


People also ask

How do I enable Python debugger in Visual Studio code?

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.

How do I debug python in Visual Studio?

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.

How do I turn off VS code debugger?

VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.


Video Answer


1 Answers

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.

like image 127
Lucas Rath Avatar answered Sep 23 '22 17:09

Lucas Rath