Hello,
I was very curious to create a small Streamlit app using Pyomo.
Unfortunately, this leads to the following error:
______________________________________________________________________________
ValueError: signal only works in main thread
Traceback:
....
File "...\site-packages\pyomo\opt\base\solvers.py",
line 582, in solve _status = self._apply_solver()
File "...\site-packages\pyomo\opt\solver\shellcmd.py",
line 244, in _apply_solver self._rc, self._log = self._execute_command(self._command)
File "...\site-packages\pyomo\opt\solver\shellcmd.py",
line 332, in _execute_command self.process_soln_file(results)
File "...\site-packages\pyutilib\subprocess\processmngr.py",
line 554, in run_command # = signal.signal(signal.SIGINT, handler)
File "...\lib\signal.py",
line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
______________________________________________________________________________
By removing a few lines in processmngr.py, I could make it work.
These are the lines 548-556 dealing with "define_signal_handlers" .
This works on my laptop.
Of course, this is not a good solution once I want to publish my Streamlit app on
share.streamlit.io .
Would you have some suggestion to solve the problem without cutting lines of code in processmngr.py ?
I had a look to see if I could make use of process of threads, but this is beyond my competences and I guess there is not such solution. But who knows?
Any suggestion welcome!
Thanks
Michel