O just installed the new version, and from time to time, when I change the dataset I am working with, I get this error.
I suspect is has something to do with the session state thing (that I have not implemented yet in any way). Can anybody point me in the right direction?
I also noticed that the new version behaves differently, so my old code does not work anymore and I had to downgrade.
Before I would change the value in a widget, and then click the “run” button and it would rerun.
Now if I change the value in a widget and click “run” nothing happens.
It must be tied to something wrong I did in the implementation of the app, but I would like to upgrade but I have no idea what is going on and how to fix it.
Thanks for bringing this up. It seems we made an assumption on widgets with options to be indexable, which is invalid once using dataframes. The easy workaround is to use list around the options argument. We are working on a patch release to address this in the next couple days. We have a fix for this, and you can test drive it here: https://share.streamlit.io/streamlit/core-previews/pr-3515 Just place your code in the text box and see if it’s fixed. If it’s still an issue (and it works in 0.83) let me know. Any information about what the input type in is appreciated as well.
Thanks for following up. I am wondering what type is indexColsSelectBox specifically, and I wonder if passing list(indexColsSelectBox) would be a workaround. We essentially checked if elements were "indexable "but didn’t realize that some inputs were not properly indexable.
Combining Session State with the state of widgets have proved some interesting challenges. We hope to address these all quickly!
indexColsSelectBox is a list already. I get the list of the dataframe column names and add a “None” at the beginning of the list for the “do not filter anything” user choice.
Is there a toy example I can play with to identify the issue? Essentially, the error is suggesting the value being returned is not in the list of options. I wonder if it’s a type issue (e.g. comparing None to "None", or something else. If you have an example, I’ll get down to the bottom of it.
thanks so much for your help. I am not sure how to set up the toy example.
I tried to check your idea of the app having an issue between None and “None”.
I changed “None” to the “Something else” string
Until I do not filter anything, until I leave “Something else” in my widget, once I click on “Submit” the app works and returns my beautiful chart.
The console also stays clear except for this warning message. But in my app you can choose to upload a file or to play with a test file. I am doing the latter so it is ok.
Thanks @Fabio for that analysis! It’s really helpful. I still need to see what Streamlit is thinking the iterable is. I’ve constructed the toy example here based on the information provided, and it works, so there must be some other failure happening. indexColsSelectBox not a formal list and is say a data frame or series. Is the key changing? Is the label changing?
import streamlit as st
tooltip = """Select a column you want to filter on.
"""
indexColsSelectBox = [
"None",
"Material",
"Country",
"Channel",
"Complication",
"Customer",
"Line",
"Brand",
"Product"
]
foo = st.selectbox("Column Label", indexColsSelectBox, help=tooltip, index=0, key="filterColumn1")
st.write(foo)
With a working broken sample script, I can run it through our debug tools. Any way we can pare down the current script into something that demonstrates the broken behavior and you can send the script for us to test?
I am super appreciative of this by the way and am loving this feedback!
I finally tried your first suggestion, passing list(indexColsSelectBox) instead of indexColsSelectBox and it seems to work. There are no errors in the console.
When you st.write list(indexColsSelectBox) and indexColsSelectBox they look alike but the important thing is that this works.
I have a last question. Should I wait for your new fix that avoids the need of wrapping my lists in “list()” or should I do this for all my widgets? I will implement the session state function is the near future but it is not an immediate priority for me.
I’m glad we got to the bottom of it. You can try printing st.write(type(indexColsSelectBox)) and see what it produces. My guess is a data frame index.
That being said. We are targeting a fix early next week, so you should be able to get this working without the list
That’s weird. We have merged the changes in. You can try installing streamlit-nightly tonight pip install streamlit-nightly and ensure it works. We hope to get this in a patch release early next week.
Hey @Fabio I’m starting to run out of ideas. Can you provide a small example script that demonstrates this? I can test it out and figure out what’s going on.
I fully understand and I really appreciate you efforts. However I am a self taught programmer and my app is 20000 lines long, so I would not know how to cut out a piece that replicates the error.
Since I am the only one you got this problem it must have to do with some idiosyncrasy in my code.
Haha. Good for you @Fabio on being self-taught! Your ability to go in depth is super valuable. Let us know if you figure out the problem or have a small example for us to debug. Happy to help where I can!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.