I am currently working on a Python project using the latest version on VSCode on Ubuntu 24.04.
When I run my project without using the debugger
python3 -B Main.py
I don't get any .pyc
files created, which is fine.
However, when launching the debugger using the following launch.json file
{
"version": "0.2.0",
"configurations": [
{
"name": "Run project in Debug Mode",
"type": "debugpy",
"request": "launch",
"program": "Main.py",
"args": ["-B"]
}
]
}
I get pycache .pyc
files created accross the project packages.
Is there a way to get the -B argument to work in a launch.json file ?
Thanks
Well, I should probably wait before I post since I found a solution shortly after. Anyone interested, here is a solution that works:
Source: https://github.com/microsoft/vscode-python/issues/6986#issuecomment-581960186
{
"version": "0.2.0",
"configurations": [
{
"name": "Run project in Debug Mode",
"type": "debugpy",
"request": "launch",
"program": "Main.py",
"console": "integratedTerminal",
"env": {
"PYTHONDONTWRITEBYTECODE": "1"
}
}
]
}