VSCode 调试器自动附加到子进程



在下面的控制台输出中,它清楚地表明断点在新进程中不起作用。 用于附加到子进程的调试器设置在哪里?

pydev debugger: starting
pydev debugger: New process is launching (breakpoints won't work in the new process).
pydev debugger: To debug that process please enable 'Attach to subprocess automatically while debugging?' option in the debugger settings.
Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:8080/
Hit Ctrl-C to quit.

是的。截至2018年底,VSCode可以调试python子进程。 我们只需要正确设置配置。 在 Visual Studio 代码中,编辑launch.json文件,并将"subProcess": true键值对添加到正在使用的调试配置中。 下面是一个示例。

"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"subProcess": true,
"program": "${file}",
"console": "integratedTerminal"
}

]

我不知道如何附加到子进程。 但是,我在调试 python 烧瓶时遇到了同样的问题,我注意到pydev debugger: New process is launching ...问题与我在 app.run 中使用use_reloader=True相关。当我删除它时,断点工作正常!

最新更新