Summary
Why do I get a key not initialized error when using data_editor with key set to “feeds”. No example of using a key value requires initialization prior to use.
Steps to reproduce
Code snippet:
if st.session_state['SELECTED_SITE_FEEDS_DATA']:
st.data_editor(st.session_state.save_feeds_data,use_container_width = True,num_rows = "dynamic",column_config={
"delete?": st.column_config.CheckboxColumn(
"Delete?",
help="Check to Remove This Feed",
default=False,
)},on_change =callback(),key="feeds_data")
else:
st.write("You must select a site before editing feeds")
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
I expect the key to be created in the sessions dictionary with current data.
Actual behavior:
Error Message: AttributeError: st.session_state has no attribute “feeds_data”
Debug info
- Streamlit version: (get it with
$ streamlit version
) 1.27 - Python version: (get it with
$ python --version
) 3.10 - Using Conda? PipEnv? PyEnv? Pex? Conda
- OS version: Mac OS Monterey
- Browser version: Latest chrome
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app:
Additional information
If needed, add any other context about the problem here.