Visual Studio Code: How debug Python script with arguments
VS code not working for python debugging - Python - Code with Mosh Forum
How to debug a Python module in Visual Studio Code's launch.json - Stack Overflow
VSCode / Python / Debugging / venv?
Videos
Actually, there is a very simple option to do this I found by accident while trying to edit the launch.json file.
"type": "python",
"request": "launch",
"pythonPath": "D:\\ProgramData\\Anaconda3\\envs\\simulec\\python.exe",
"module": "my_module.my_file",
Simply specify the module in the module key "module": "my_module.my_file"
The -m is not useful any more.
To add slightly to dzada's answer, which helped me a lot, a Visual Studio Code variable can be used to make this general for debugging any file that is in your module.
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "my_module.${fileBasenameNoExtension}"
}
]
}
Which is probably what you want to do.
Hello - i would like to debug my pyhon - programs using vscode -
But how can i choose the correct venv-environment for running the program?
It seems that when i start the Debugging that it allways take the default configuration - and there are not all python-modules i need for the program - cause they are installed only in the venv.
How can i choose the venv for debugging?