I have the following launch.json
:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "debug streamlit",
"type": "debugpy",
"request": "launch",
"module": "streamlit",
"args": [
"run",
"$(file)"
]
}
]
}
But I get the following error when attempting to run VSC debug on Streamlit:
(Venv) workdir$ cd /workdir ; /workdir/Venv/bin/python /home/.vscode/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 52265 -- -m streamlit run \$\(file\)
Usage: streamlit run [OPTIONS] TARGET [ARGS]...
Try 'streamlit run --help' for help.
Error: Streamlit requires raw Python (.py) files, but the provided file has no extension.
For more information, please see https://docs.streamlit.io
What do I have to change to make it work?
"args": [ "run", "$(file)" ]
You should replace $(file)
with ${file}
in your launch.json file
.
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "debug streamlit",
"type": "debugpy",
"request": "launch",
"module": "streamlit",
"args": [
"run",
"${file}"
]
}
]
}