Steven D'Aprano <[EMAIL PROTECTED]> writes: > try: > process_things() > except ExpectedErrors: > recover_from_error_gracefully() > except ErrorsThatCantHappen: > print "Congratulations! You have found a program bug!" > print "For a $327.68 reward, please send the following " \ > "traceback to Professor Donald Knuth." > raise > except: > print "An unexpected error occurred." > print "This probably means the Internet is broken."
But this isn't good, it catches asynchronous exceptions like the user hitting ctrl-C, which you might want to handle elsewhere. What you want is a way to catch only actual exceptions raised from inside the try block. -- http://mail.python.org/mailman/listinfo/python-list