Re: Overriding a built-in exception handler

2005-07-21 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > I've Read-TFM, but I only see good info on how to create my own class > of exception; I don't see anything on how to override an existing > exception handler. You need to read the tutorial on handling exceptions: http://docs.python.org/tut/node10.html -- Michael Hoff

Re: Overriding a built-in exception handler

2005-07-21 Thread Jaime Wyant
You can't override an exception. You can only catch whatever exception is thrown. For your case, you would want to wrap that while loop up in a try/catch block like this: try: while 1: print "Yay for me!" except KeyboardInterrupt: print "CTRL-C caught" Someone had mentioned poss

Re: Overriding a built-in exception handler

2005-07-21 Thread Jp Calderone
On 21 Jul 2005 07:39:10 -0700, [EMAIL PROTECTED] wrote: >I'm having a tough time figuring this one out: > > >class MyKBInterrupt( . ): > print "Are you sure you want to do that?" > >if __name__ == "__main__": > while 1: > print "Still here..." > > >So this thing keeps printing

Overriding a built-in exception handler

2005-07-21 Thread callmebill
I'm having a tough time figuring this one out: class MyKBInterrupt( . ): print "Are you sure you want to do that?" if __name__ == "__main__": while 1: print "Still here..." So this thing keeps printing "Still here..." until the user hits ctl-c, at which time the except