Exception only when Debugging in VSCode

Summary

Iā€™m getting this StopException when debugging in VSCode.
Need help, here are the detailsā€¦

My .vscode/launch.json

{
    "name": "Streamlit: Current File",
    "type": "python",
    "request": "launch",
    "module": "streamlit",
    "env": {
        // any .env variables you may have
        "STREAMLIT_APP": "${file}",
        "STREAMLIT_ENV": "development",
    },
    "args": [
        "run",
        "${file}"
    ],
    "jinja": true,
    "justMyCode": true
}

Steps to Reproduce

Open app.py in VSCode and then Debug Streamlit: Current File
This occurs

Workaround

Running streamlit run app.py will work, but no debugging

Hi @rugufu

This seems to be a recurring issue for VS Code, Iā€™d recommend taking a deep dive into the VS Code GitHub issues or their forum.

To get you started, here are some related posts:

Hope this helps!

That issue has nothing to do with this problem, it seems.

Iā€™ve found that when debugging with VSCode that any navigation away from the page when still processing the python script produces an exception, specifically a StopException.

Iā€™ve tried catching this globally, and maybe Iā€™m just a python noob, but I canā€™t find the actual type to catch, and so my exception block canā€™t distinguish between the StopException and something I actually care about, so I canā€™t tell the VSCode debugger to only break on uncaught exceptions.