Ctrl-C handler, how to override?

Bruce Edge edgebruce at yahoo.com
Wed Oct 2 23:15:03 CEST 2002


How the @#$!$ do override the SIGINT handler?

I can create handlers for other signals, but not for SIGINT:

>>> getsignal(SIGINT)
<built-in function default_int_handler>
>>> def handler(signum, frame):
...   print "got signal", signum
>>> signal(SIGINT, handler)
1
>>> getsignal(SIGINT)
<function handler at 0x81466f4>

...Looks OK so far, but Ctrl-C's still call the default handler:

>>> 
KeyboardInterrupt
>>> 
KeyboardInterrupt

Thanks, Bruce.



More information about the Python-list mailing list