How to drop into a repl for debugging?

I’ve read through the docs and this forum but I can’t quite figure out how to drop into a pdb session (or similar) for debugging my streamlit app.

So far I’ve just been writing out variables with st.write as a form of print line debugging.

Thanks.

Hi @Chandler. It’s as simple as writing a line of breakpoint()

1 Like

hey Marc,

This did not work for me, I get an exception in the streamlit UI

Hi @Chandler

You can use breakpoint() in python 3.7+. Prior to that the command is import pdb;pdb.set_trace().

I’ve started writing a tutorial on using VS Code with Streamlit at https://awesome-streamlit.readthedocs.io/en/latest/vscode.html

There you can see more about debugging including using the integrated debugger.

Hope it works for you.

Marc

Keywords: VS Code, Integrated Debugger, Keyboard Shortcut.

1 Like