How to pprint st.session_state for readable inspection?

My application is very large and makes use of MANY session_state values and I’m trying to debug the application. I’ve tried to pprint(st.session_state) and tried to render it as a string, but nothing readable emerges. I want to send the session_state to a file with indentation formatting so it can be used as a “window” into the state of the application as it progresses. Instead, I can only get a list of strings which is not very human readable.
Any suggestions?

Convert st.session_state to a dictionary.

pprint(dict(st.session_state))
1 Like

yup, that did the trick. Thanks @Goyo!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.