在VS代码中等待启动器连接超时



我在VS代码中调试python。下面是这次发射。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: Current File",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"python": "${command:python.interpreterPath}",
"program": "${file}",
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
"debugOptions":[
"RedirectOutput"
],
"console": "integratedTerminal"
}
]
}

以下是设置。json文件:

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

当我在VS code中调试python脚本时,我得到了Time out waiting for launcher to connect,无法调试python脚本。

我可以知道如何解决这个问题吗?

很简单。打开launch.json文件,添加如下内容:

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

保存并退出。无论你做什么,不要清除已经存在的文本,否则可能会使它变得更糟

如果出于某种原因"internalConsole"不是一个好的解决方案:

在shell脚本中:

export PROCESS_SPAWN_TIMEOUT=30

或直接破解代码(将恢复如果你更新扩展):

.vscode-server/扩展/ms-python.python-2022.18.2/pythonFiles/lib/python/debugpy/适配器/launchers.py [161]:

改变:

timeout=(None if sudo else common.PROCESS_SPAWN_TIMEOUT)

:

timeout=30,

相关内容

  • 没有找到相关文章

最新更新