use the forking server instead of the threaded server. threads and signals don't mix too well together in python, so the interpreter blocks it.
----------------------------------------------------------------- *Tomer Filiba* tomerfiliba.com <http://www.facebook.com/tomerfiliba> <http://il.linkedin.com/in/tomerfiliba> On Tue, Oct 9, 2012 at 1:08 PM, shay berman <[email protected]> wrote: > Hi > > How to use signal.signal function via rpyc? > When I use it fail with error : ''signal only works in main thread" > > here is an example : > > *------------------------------------------* > *import rpyc* > *r = rpyc.classic.connect('remote_host')* > *r_signal = r.modules.signal* > *r_signal.signal(r_signal.SIGCHLD, r_signal.SIG_DFL) > * > * > --------------------------------------------------------------------------- > * > *ValueError Traceback (most recent call > last)* > */home/bshay/git/hostattachment/_meta/tests/xavi/hak_xavi_tests/tests_pool/<ipython > console> in <module>()* > */var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.0.7-py2.7.egg/rpyc/core/netref.pyc > in __call__(_self, *args, **kwargs)* > * 121 def __call__(_self, *args, **kwargs):* > * 122 kwargs = tuple(kwargs.items())* > *--> 123 return syncreq(_self, consts.HANDLE_CALL, args, > kwargs)* > * 124 __call__.__doc__ = doc* > * 125 return __call__* > * > * > */var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.0.7-py2.7.egg/rpyc/core/netref.pyc > in syncreq(proxy, handler, *args)* > * 43 conn = object.__getattribute__(proxy, "____conn__")* > * 44 oid = object.__getattribute__(proxy, "____oid__")* > *---> 45 return conn().sync_request(handler, oid, *args)* > * 46 * > * 47 def asyncreq(proxy, handler, *args):* > * > * > */var/tmp/xavi-xpyv/lib/python2.7/site-packages/rpyc-3.0.7-py2.7.egg/rpyc/core/protocol.pyc > in sync_request(self, handler, *args)* > * 340 isexc, obj = self._sync_replies.pop(seq)* > * 341 if isexc:* > *--> 342 raise obj* > * 343 else:* > * 344 return obj* > * > * > *ValueError: signal only works in main thread* > * > * > * > * >
