I wanted to display something like this: st.spinner(text=âWait for ResultsâŚâ) for an unknown time period. I want to run the spinner until a file doesnât exist in my local system, which is getting created meanwhile by another python program.
import streamlit as st
import os.path
import time
file_exists = os.path.exists('readme.txt')
with st.spinner('Wait for it...'):
while not file_exists:
st.write(f"""file exists: {file_exists}""")
# do nothing
time.sleep(1)
file_exists = os.path.exists('readme.txt')
st.success('Done!')
Hi @willhuang, sorry for the delayed reply. I had a mistake in the original question, which I am unable to edit. My file is getting created by the âsameâ streamlit program, not âanotherâ program. Using your code thus makes it stuck in an infinite while loop, unfortunately because in that icase it never escapes the loop.