forcing exceptions

Gary Herron gherron at islandtraining.com
Fri Mar 3 14:49:21 EST 2006


Bill Scherer wrote:

>Nikola Skoric wrote:
>
>  
>
>>Is there a way to tell the interpreter to display exceptions, even those
>>which were captured with except?
>>
>>    
>>
>I believe you are looking for "raise".
>For example:
>
>Try:
>   some.code()
>except SomeError:
>   do.whatever()
>   raise
>  
>
I don't think that's what was asked for.  That will reraise the 
exception, but there is no guarantee that it will be displayed -- there 
may be further "except"s up stream to catch it.    A 
traceback.print_exc() within the "except" clause will print it at that 
point, then execution can continue normally.

Gary Herron

>
>
>- Bill
>  
>




More information about the Python-list mailing list