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

标签 python visual-studio-code pydev bottle

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

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/

相关文章:

java - 使用 VS Code 在 Spring Boot 中设置 GCP 环境变量

python - "Go to definition"和 "package Explorer"的 Pydev 问题

python - 在 PyDev 中运行 Twisted 应用程序

Python 在命令行和 eclipse 中使用 pydev 的行为不同

python - 了解双线性层

asp.net-core - 在当前目录中找不到 'project.json' - .NET Core Webapp 调试

python - 如何增加一个值并重置另一个值。 PYTHON

Svelte 中非标准窗口事件的 TypeScript 类型化

python - 如何在 Python 中使用请求处理 <TooManyRedirects : Exceeded 30 redirects.> 异常?

python - 图像字段模型形式的 Django 自定义验证(最大文件大小等)