Time out waiting for launcher to connect in VS code

Viewed 1562

I did python debugging in VS code. The following is the launch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "stopOnEntry": false,
            "python": "${command:python.interpreterPath}",
            "program": "${file}",
            "cwd": "${workspaceFolder}",
            "env": {},
            "envFile": "${workspaceFolder}/.env",
            "debugOptions":[
                "RedirectOutput"
            ],
            "console": "integratedTerminal"
        }
    ]
}

The following is settings.json file:

{
    "python.pythonPath": "c:\\Users\\susan\\Documents\\PythonScripts\\venv\\Scripts\\python.exe",
    // to fix 'Timeout waiting for debugger connections'
    "python.terminal.activateEnvironment" : false
}

When I debug the python script in VS code, I got Time out waiting for launcher to connect and cannot debug the python script.

May I know how can I solve this issue?

1 Answers

Its very simple. Open the launch.json file and add the following into it:

{
  "name": "Python: Debug Console",
  "type": "python",
  "request": "launch",
  "program": "${file}",
  "console": "internalConsole"
}

Then save and exit it. Whatever you do, DO NOT clear the text already in there or else it may make it worser

Related