Hi
I’m new to Streamlit. I have noticed a strange problem in my app. Basically, i load a csv file and want to do a quiz (question / answer) based on the content.
Once the file is loaded, i create a list of word from which I want to pop() the first element for the first question and so one.
The problem is that as soon as i call pop(), the text_input stop working. I’ve noticed this strange behaviour only when my list is created from the dictionnary loaded from the CSV.
Any idea what could cause this?
Are you running your app locally or is it deployed?
Executed locally
If your app is deployed:
N/A
Share the link to your app’s public GitHub repository (including a [requirements file]
Hi Ferdy
Thank you for helping me in this topic.
The code that is in the Github link. Let me know if you can access it, it should, I’ve made it public.
I’ve misinterpreted the source. It is not pop() but rather accessing that list i create from the file read. I’ve done some more testing yesterday, redid the code to use an object holding all this information and have the same behaviour.
I’ve put Steamlit in debug, and see this. Note that the last message is a print statement that shows that the text_input does not return a value which is THE problem for me.
I use your code in repo and load the csv. In the function,
def read_word_dictionary_from_csv(file):
word_dict = {}
with file:
reader = csv.reader(file)
for row in reader:
if len(row) > 0:
# pronoun, spanish, french, details, five, six, seven = row
pronoun, spanish, french, details, five, six = row
word_dict[spanish.strip()] = french.strip()
return word_dict
I changed # pronoun, spanish, french, details, five, six, seven = row
to # pronoun, spanish, french, details, five, six = row
because the csv has only 6 columns.
Hi Ferdy
Ah yes sorry. I changed the structure of that CSV but didn’t updated this small app. I have not shared the complete project… .which I should probably do.
Try typing something in the box, on the “next” iteration, the problem should be seen. I mean, the text_input not submitting any text anymore.
Hi @dataprofessor
Yes. I have re-written the small app and used index to access the list content and I have the same behaviour.
Something strange in happening in the session state. I will share my new code later today and maybe you guys will be able to see what I am doing wrong. I’m pretty sure it’s my fault but can’t figure what I’m doing wrong
Thanks for the help!
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.