Trace KeyboardInterrupt exception?

Tony Nelson *firstname*nlsnews at georgea*lastname*.com
Wed Jun 14 13:26:03 EDT 2006


In article <1150293702.090195.324550 at y43g2000cwc.googlegroups.com>,
 andrewdalke at gmail.com wrote:

> Tony Nelson wrote:
> > I'm trying to find out what is eating some KeyboardInterrupt exceptions
> > in a fairly large program (yum).  My KeyboardInterrupt handler is called
> > for some Ctl-C presses, but for others nothing seems to happen.
> 
> >  ... I'd like to use a debugger to trace
> > KeyboardInterrupt exceptions, make sure that they're happening, and see
> > what is handling them.
> 
> I don't know how to do that in Idle.  You can replace the default
> Ctrl-C interrupt handler with your own and use that to inspect the
> current stack.

Thanky you, that helps.  Interestingly, some Ctl-Cs don't get caught.  
Presumably they're happening in a subprocess.

Now to see if I can get into that situation again where Ctl-C is 
ignored.  I need to know what's eating the exceptions.  I don't think 
it's a subprocess in the case I'm concerned with.  I don't think yum is 
threaded, but apparantly importing the tread module anywhere should keep 
KeyboardInterrupt on the main thread anyway (?).

It would be nice if I could inspect the stack and find the exception 
handlers.  I'm using trace handlers, but their output seems somewhat 
spotty and inconsistent, or maybe just confusing.
________________________________________________________________________
TonyN.:'                        *firstname*nlsnews at georgea*lastname*.com
      '                                  <http://www.georgeanelson.com/>



More information about the Python-list mailing list