Running the debugger results in "There was an error in starting the debug server"
See original GitHub issueEnvironment data
VS Code version: Version 1.19.3 (1.19.3) Python Extension version: 2018.1.0 Python Version: 2.7.13 OS and version: macOS High Sierra 10.13.2 (17C205)
Actual behavior
When attempting to debug a Python file, as soon as it is launched I get an error in the debug console as well as an alert banner with the message: There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","address":"localhost"}
The debugger does not start. I used the debugger successfully previously. That was a few months ago at this point, so I have no idea what versions are different or what has changed on the host machine.
Expected behavior
The file should be debugged as normal.
Steps to reproduce:
- Open a .py script
- Select the debugger tab on the left
- Select the “Python” configuration (
launch.json
is below) - Click the run button
Logs
Output from Python
output panel
There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","address":"localhost"}
There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","address":"localhost"}
Output from Console window
(Help->Developer Tools menu)
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:249 [Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:249
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2742 There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"localhost"}
e.doShow @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2742
Contents of launch.json
:
{
// 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",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
"debugOptions": [
"RedirectOutput"
]
}
]
}
python.pythonPath
is set to use the Homebrew Python at /usr/local/bin/python2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:10 (1 by maintainers)
Top GitHub Comments
Finally, I found my macOS system hosts file is empty and I fixed this problem with adding “127.0.0.1 localhost” to hosts file.
@breadplop The hosts file tells your machine about special hostnames. More info here: https://en.wikipedia.org/wiki/Hosts_(file)