admin管理员组文章数量:1122846
I have a monorepo project built with Bazel and I'm trying to integrate VSCode debuggers directly with Python targets I'm running.
There is a similar question that helps solve the problem here: How to use the vscode python debugger with a project built with bazel?
But I would like to do this without altering the source code and just putting a breakpoint in the code using the Python debugpy
module.
I tried the following command and it waits for me to attach a debugger (using the launch.json configuration below), but then it proceeds with the
bazel run --run_under="debugpy --listen 0.0.0.0:5678 --wait-for-client" //path/to/target/tests:dummy_tests
Here is my launch.json to attach to the debugpy server.
{
"configurations": [
{
"type": "debugpy",
"request": "attach",
"name": "Attach to a running debugpy",
"debugServer": 5678
}
]
}
I was expecting that the breakpoint was hit, but it just continued through the test.
If I add the code snippet from the linked question above, and run without the --run_under
command, everything looks fine and the breakpoint is hit.
import debugpy
debugpy.listen(5678)
debugpy.wait_for_client()
bazel run //path/to/target/tests:dummy_tests
版权声明:本文标题:How to integrate VSCode debugger for Python Bazel projects without altering source code? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736283772a1927076.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论