Reputation: 779
I have a python project and a command which runs the project which I'd like to debug.
Here is my 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 (i.e. it would run the command as expected, but it would not trigger breakpoints).
Any idea how I can achieve this?
Upvotes: 1
Views: 2070
Reputation: 779
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.
Upvotes: 1