I have two questions which I will create two post separately.
- When there is an error or expected exit, what can be used to exit the script.
As I see exit(). sys.exit() are not useful in streamlit.
I tried something from: https://gist.githubusercontent.com/treuille/bc4eacbb00bfc846b73eec2984869645/raw/734a2522d68920dfd1c875f321df67b3168afbf5/confirm_button_hack.py
“”“Special Exception which does not display any output to the Streamlit app.”""
try: fl= open(textfile,'r', encoding = "utf-8") except StopExecution: st.write (' text file doesnot exist.. exiting') pass if 'string' in open(textfile).read(): st.write ("") else: st.write ('file is empty.. exiting') raise StopExecution
Tried several pattern but I was not successful. Anyone can please suggest if this is correct or am I missing something.