Hi,
I have a problem with my streamlit app. I am trying to generate an image and save it to a file, which is then downloaded via the app. I do not need the figure to be displayed in the streamlit app.
When I run the app I get the following message, even though the image is created and saved in the appropriate place.
WARNING: QApplication was not created in the main() thread.
Then, if I run the app a second time I get the following error with only a blank image saved.
QObject::startTimer: Timers can only be used with threads started with QThread
I am plotting the figure using a package called ete3, which generates trees. These are then saved to PNG, PDF or SVG files.
I realise that my problem relates more to this package but I do not get any error when I generate the figure in a script outside of streamlit, so I hope some streamlit people could point me in the right direction please!
I’m using Streamlit v1.12.0/Python 3.9.13/Conda/MacOS 11.6
Here is a minimal reproducible example:
st.title('Click button to generate figure. Error appears on command line.')
form = st.form(key="submit_form")
with form:
submitted = st.form_submit_button(label="Submit")
if not submitted:
st.stop()
t = Tree( "((a,b),c);" )
t.render('Test_figure.png')