ovidiu at cup.hp.com
Fri Jun 25 02:28:59 CEST 1999
Thooney Millennier wrote:
> Hi, I want to use "signal()" in my program.
> import signal;
> def func(arg1,arg2):
> print "OK!";
> It seems "func()" is not called
> when the program gets signal "SOME_SIGNAL".
It looks like you forgot to send the signal. One way you could implement
this code is:
from signal import signal, SIGINT
from os import getpid, kill
def signalHandler (signum, frame):
print 'signal handler called for signal %d' % (signum,)
signal (SIGINT, signalHandler)
kill (getpid (),
Take a look at the manpage for signal(7) to get the list of signals you
can send to a process.
Hope this helps,
Ovidiu Predescu <ovidiu at cup.hp.com>
More information about the Python-list