Adding attributes to session state

What is wrong? I added the attribute ‘psyZ’ but it still shows the error like it’s not in there

Hi @Rockkley,

Can you double-check that you have saved the file you made? Also, make sure your Streamlit version is up to date. From the small snippet, it looks correct to me, but there might be something else happening in other lines of code that I can’t see.

If those two things don’t work, can you post a link to your code via GitHub or just a complete copy of your code would help so I can trace the error?

Happy Streamlit-ing
Marisa

Hey @Rockkley,

I just copy-pasted your code as-is and ran it with Streamlit v.1.2.0 and v.1.3.1 and it works as expected with no errors:

it was right after you pressed the button that it was giving you the initialization error on line 49 correct? the st.write(f'Достоверность Zero: {str(psyZ[0])}, *история догадок - {str(st.session_state.psyZ[1::])}\n*')?

Can you tell me what version of Streamlit you have running on your local computer? If you terminate the Streamlit process and restart with streamlit run testWithStreamlit.py does it work? Also, make sure your using the most up-to-date version of streamlit with pip install streamlit --upgrade

Happy Streamlit-ing
Marisa

Thanks Marisa. Yeah, I got the latest version of Streamlit. I found out that the error message appears only if I try to run it not in terminal (by ctrl+shift+F10 in Pycharm), but when I try to run it with “streamlit run …py” in terminal, it works fine without any errors appearing.

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