[英]Vscode debug custom command
I have a python project and a command which runs the project which I'd like to debug.我有一个 python 项目和一个运行我想调试的项目的命令。
Here is my launch.json
:这是我的
launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"command": "pipenv run python -m myproject.mymodule --count 500",
}
]
}
This does not work, but my goal is to run the command from above and have it catch breakpoints and step through, etc.这不起作用,但我的目标是从上面运行命令并让它捕获断点并单步执行等。
I have tried setting it as a preLaunchTask
with a tasks.json
file, but when I use this, it does not let me use the debugging features for the command (ie it would run the command as expected, but it would not trigger breakpoints).我尝试将其设置为带有
preLaunchTask
文件的tasks.json
,但是当我使用它时,它不允许我使用命令的调试功能(即它会按预期运行命令,但不会触发断点) .
Any idea how I can achieve this?知道如何实现这一目标吗?
For anyone coming across this, after doing some more research, I found this works:对于遇到此问题的任何人,在进行了更多研究后,我发现这很有效:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "myproject.mymodule",
"args": ["--count", 500]
}
]
}
This is equivalent to running to command pipenv run python -m myproject.mymodule --count 500
and debugging features such as breakpoints are being triggered.这相当于运行命令
pipenv run python -m myproject.mymodule --count 500
并触发断点等调试功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.