[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] Re: handling keyboard interrupts nicely?
From:       "Burley, Brent" <Brent.Burley () disney ! com>
Date:       2003-01-28 18:48:24
[Download RAW message or body]

Martin Blais wrote:
> i have been looking for a FAQ about this, and everywhere else, and i would 
> have thought that would be the first question most people would be asking 
> after trying PyQt:  how do you handle KeyboardInterrupt's from a PyQt app?

Unfortunately, PyQt catches all exceptions and just prints them out. 
I don't believe there's a way to change that behavior.

You can, however, override python's ctrl-c handler using the signal
module.  Note: the handler won't be called until the python
interpreter gets control again.  If what you're trying to do is just
kill the app quickly, then just restoring the default handler will
work:

  import signal; signal.signal(signal.SIGINT, signal.SIG_DFL)

As an alternative, you can try ctrl-\.  On most unix systems, this
sends a sigquit which should kill the app immediately in all cases,
though you'll have to put up with core dumps.  I don't know about
windows.

	Brent Burley

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic