错误是这样的:
There was an error in starting the debug server. Error = {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":3000}
launch.json 中“Python Attach”的设置如下所示:
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
好像少了点什么。我意识到没有 debugOption 但我不知道如何修复它。更新之前一直工作得很好。有什么帮助吗?
最佳答案
您可以在调试期间通过替换或选择来使用以下简单设置。
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${file}",
"pythonPath": "${config:python.pythonPath}",
"debugOptions": [
"RedirectOutput"
]
}
此外,对于我来说,错误的/etc/hosts 配置导致了问题“error:listen eaddrnotavail”,为面临相同问题的人添加
关于python - 我无法在 vscode 中运行代码或调试 python 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47306704/