在下面的控制台输出中,它清楚地表明断点在新进程中不起作用。用于附加到子进程的调试器设置在哪里?
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 Code 中,编辑 launch.json
文件并将 "subProcess": true
键值对添加到您正在使用的调试配置中。这是一个例子。
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"subProcess": true,
"program": "${file}",
"console": "integratedTerminal"
}
]
关于python - VSCode 调试器自动附加到子进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50190683/