Hi all,
I am a 1 week user of Streamlit and loving it thus far. Please may I outline my issue and question.
I have written a script that uses multiple win32com Dispatch calls which works perfectly in Spyder (note this is a work project which interfaces with an old software, and I cannot share the code )
When I run in Streamlit the whole thing freezes. If I ctrl + c in the terminal it says stopping but never does. The part where it freezes is a backend Dispatch call.
I am wondering if there is a way to run the streamlit front end on one thread and the backend (script) on another thread, and if this will help me?
If it is possible, is there a simple guide? (I am a data analyst, not a programmer).
To add a little bitâŠIt almost âfeelsâ like Streamlit is blocking the win32com Dispatch call, so the program just sits there.
This is why I wondered if I could run the Dispatch calls on a different thread.
If youâre using Windows 10 it might have something to do with Windows Defender and âremote code executionâ since youâre not calling win32com Dispatch directly but via the tornado webserver. Iâve had a similar problem with win32com and Excel sheets when trying to run them via a webserver as a service. Workaround at the time was to turn off âreal-time protectionâ.
So that is the thing, there is no error per se, nothing printed in the terminal. The program just gets stuck when it tries to access the Dispatch call. The web front end continues to say âRunningâ, the terminal just sits there sucking itâs thumb.
Is there a way to see âhiddenâ error messages?
Hello again,
So after some debugging today I realised that the COM module works for most Dispatch calls, but not with the call that I make to our internal software.
I think you may be correct @maarten-betman that the software I am using does not like being called by the Tornado server.
But happily I can report that I found a work-around!
I used the python module âsubprocessâ.
So Streamlit handles the front end + the logic, inputs, then I pass the inputs to another python script which runs as a subprocess in another terminal.
This works perfectly and I am excited to show my boss tomorrow!
Thank you for the helpful advice and encouragement!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking âAccept allâ, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.