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.