How to suppress warning during direct python running?

I’m merging my current project with a streamlit frontend. I have a main app.py to control the whole page, while there are some log/prints/progress in other imported modules or classes i’d like to show either. Besides passing a positional st.empty() object into it and write, I’m thinking use st.write() to show things if frontend is on. Since it’s also possible that I run these scripts directly in python console, st.write is bypassed, of cause, but i get these warnings:

Blockquote
Warning: to view this Streamlit app on a browser, run it with the following
command:
streamlit run C:\Program Files\JetBrains\PyCharm 2020.1\plugins\python\helpers\pydev\pydevconsole.py [ARGUMENTS]

Is there a way to suppress these warnings because it’s exactly what I want ?

1 Like

I would also like to turn this off, as I can call my script from both the command line or as an interactive app – is there a solution for suppressing this warning?

Yes, it can be toggled off by setting showWarningOnDirectExecution = false

https://docs.streamlit.io/en/stable/streamlit_configuration.html#view-all-configuration-options

Best,
Randy

Thank you so much Randy! I didn’t initially think this would be found in the config settings, but that does make sense now. Your solution works perfectly :slight_smile:

Thanks again,
Matt

1 Like