Error "signal only works in main thread"
stm <[email protected]>
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'd like to create a simple web API using Cherrypy that can be used to
solve some optimization problem using Pyomo (pyomo.org).
When Pyomo's solve method is called I get the error "signal only works in
main thread".
What can I do to make this work? Is it possible to make Cherrypy run on the
main thread? (I know it'd be slower, but don't mind)
Here's a minimal example to reproduce the problem:
https://gist.github.com/anonymous/ea94c3c45bbcb71a6850
The full error message is:
Traceback (most recent call last):
File "C:\...\pyenv\lib\site-packages\cherrypy\_cprequest.py", line 670,
in respond
response.body = self.handler()
File "C:\...\pyenv\lib\site-packages\cherrypy\lib\encoding.py", line 217,
in __call__
self.body = self.oldhandler(*args, **kwargs)
File "C:\...\pyenv\lib\site-packages\cherrypy\_cpdispatch.py", line 61,
in __call__
return self.callable(*self.args, **self.kwargs)
File "cherryerror.py", line 14, in index
result = SolverFactory("glpk").solve(m)
File "C:\...\pyenv\lib\site-packages\pyomo\opt\base\solvers.py", line
557, in solve
_status = self._apply_solver()
File "C:\...\pyenv\lib\site-packages\pyomo\opt\solver\shellcmd.py", line
135, in _apply_solver
self._rc, self._log = self._execute_command(self._command)
File "C:\...\pyenv\lib\site-packages\pyomo\opt\solver\shellcmd.py", line
195, in _execute_command
tee = self._tee
File "C:\...\pyenv\lib\site-packages\pyutilib\subprocess\processmngr.py",
line 455, in run_command
signal.signal(signal.SIGINT, verbose_signal_handler)
*ValueError: signal only works in main thread*
Thanks!
--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.