I now have signal.siginterrupt(signal.SIGINT, False) in the line below signal.signal(signal.SIGINT, interrupt_handler)
Unfortunately, pressing ^c still results in the same interrupt error. I also tried putting signal.siginterrupt into the interrupt_handler function, which gave an interesting result: File "/usr/local/bin/obspysod", line 586, in interrupt_handler signal.siginterrupt(signal.SIGINT, False) AttributeError: 'int' object has no attribute 'siginterrupt' Could there be a namespace problem? On 2011-05-15, Nobody <nob...@nowhere.com> wrote: > On Sun, 15 May 2011 09:44:04 +0000, Christoph Scheingraber wrote: > >> signal.signal(signal.SIGINT, interrupt_handler) > >> This worked fine in some rare lucky cases, but most of the times, the >> module I am using (my university's seismology project) catches the SIGINT >> and quits: >> >> select.error: (4, 'Interrupted system call') > > After installing the signal handler, call: > > signal.siginterrupt(signal.SIGINT, False) > > This will cause (most) interrupted system calls to be restarted after the > signal has been handled. > >> How can I prevent the imported module's function from catching the >> interrupt signal? > > It isn't catching the signal. Unless you enable restarting of system > calls, an interrupted system call will typically fail with EINTR. Python > typically reports failures via exceptions; failures due to EINTR aren't > handled differently. > -- Chris Scheingraber - www.scheingraber.net -- http://mail.python.org/mailman/listinfo/python-list