signal handler

Jeff Rush jrush at summit-research.com
Tue Jun 29 12:48:45 CEST 1999


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

   try:
       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 pk.highway.ne.jp> 
wrote:

> 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