One quick hack is to turn off Python's handling of SIGINT:

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

This means that Ctrl+C will make the program die immediately (of
course, that means you can't hook it for a clean shutdown).

Matt

On Tue, May 02, 2000 at 11:41:32AM -0500, LF11 wrote:
> James Henstridge wrote:
> 
> > On Sun, 30 Apr 2000, LF11 wrote:
> >
> > > How do I force a PyGTK app to quit when it receives a KeyboardInterrupt?
> > > (Ctrl+C)
> >
> > If python and pygtk were compiled with thread support (pygtk adds thread
> > support if it finds python has thread support), doing C-C at the console
> > doesn't seem to have an effect.  You can do C-Z and then kill the process
> > though.  This problem doesn't seem to occur if python/pygtk isn't compiled
> > with thread support.
> 
> Does that mean I have to recompile Python/PyGTK without threads?  Ouch!
> 
> Should I go play in the PyGTK module source and put a 'try:/except:
> KeyboardInterrupt'?
> 
> I'll try the later first, but otherwise I'll just have to go with kill -9
> [ugly_locked_up_process]. :-(
> 
> -lf
> 
> --
> The basis of civilization...
> 1.  Do all you have agreed to do.
> 2.  Do not encroach on others.
> 
> 
> 
> -
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to