Home     My Faqts     Contributors     About     Help    

faqts : Computers : Programming : Languages : Python

FAQTs repaired & updated!
Thanks for your patience...
Entry Add Entry Alert - Edit this Entry

Did You Find This Entry Useful?

6 of 9 people (67%) answered Yes
Recently 6 of 9 people (67%) answered Yes

How can I create a 'catch all' way to catch all possible signals?

Aug 29th, 2002 17:14

Peter Funk, Joćo Prado Maia


On unixoid operating systems (AIX, Linux, SunOS, ...) there is
a special signal called SIGKILL, which can't be catched at all.
With the exception of this you can try the following:
import signal, os
def mysignal_handler(signum, frame):
    print 'Signal handler called with signal', signum
for signum in range(signal.SIGHUP, signal.NSIG-1):
    if signum != signal.SIGKILL:
        signal.signal(signum, mysignal_handler)



© 1999-2004 Synop Pty Ltd