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.