У меня есть следующее 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)"
]
}
]
}
Но при попытке запустить отладку VSC в 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
Что мне нужно изменить, чтобы это заработало?
"args": [ "run", "$(file)" ]
Вам следует заменить $(file)
на ${file}
в вашем 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}"
]
}
]
}