signal handler

Jeff Rush jrush at
Tue Jun 29 06:48:45 EDT 1999

To catch the Control-C keyboard interrupt, you can just do the following,
depending upon what you are trying to accomplish:

       pass # Do Whatever
   except KeyboardInterrupt:
       print "*** BREAK ***"

It may be the Python interpreter is interfering with your handler,
since it catches the keyboard interrupt and turns it into an exception.

-Jeff Rush

On Mon, 28 Jun 1999 14:30:41, Thooney Millennier <too at> 

> I am sorry for my late reply,
> and thank for your suggestion.
> I did't know functions such as
> "getpid()","kill()".
> Well, I tried and realized...
> If you use "kill(getpid(),SIGINT)",
> it works. (ie. callback ok!)
> Instead,if you send "Control-C" by keyboard input,
> it does not. (nothing happens,signal ignored)

More information about the Python-list mailing list