Hello blackary, thanks so much for your help!
I managed to solve the authentication problem but have a new issue.
I created a multi page streamlit app and created 2 authentication fields - one login widget for existing users and one register new user widget.
When I run the app locally, the user details (name/email/hashed passwords) are automatically written into my config.yaml file.
However, I have now deployed my app on the streamlit cloud, where the code is hosted in github. I connected streamlit to googlesheets and I am now trying to get it to write the yaml data into an empty google sheet so that I can collect the information of new users.
However, it keeps throwing up this error: ValueError: I/O operation on closed file. Please help!
this is the line that keeps throwing up the error:
How do i save this yaml dump data into a google sheet? pls help! thank u!
I have already connected it to GCP here:
gc = gspread.service_account(filename=âgcp-creds.jsonâ)
worksheet = gc.open(âconfigâ).get_worksheet(0)
I would recommend skipping the yaml step, and just writing the data directly to the sheet. You could even use the experimental GitHub - streamlit/gsheets-connection if that seems helpful. I donât believe a worksheet will function well as an open file, which is what yaml.dump expects.
Thanks blackary! I fixed it! Not sure if this is the best method but this is what I did: I hosted the yaml config file in a google cloud storage bucket. So this means that when the app is deployed on streamlit cloud, it reads the code from github, but gets the config yaml file from GCS. And when a new user registers, it will write the new user particulars into the yaml file in GCS. If I want to view the particulars of new registered users, Iâll just need to download that yaml file from GCS.
Let me know your thoughts and if thereâs a better way to do this! I am not sure if a gsheets connection would work cos I believe the config file needs to be in yml format?
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.