try except inside exec

Michele Petrazzo michele.petrazz at
Sun May 31 04:37:29 EDT 2009

Aaron Brady wrote:
> Exceptions are only caught when raised in a 'try' statement.  If you
>  don't raise the exception in a try statement, it won't be caught.
> The function you posted will raise an exception.  If you are making 
> the call yourself, that is, if only the definition is foreign, then 
> simply catch exceptions when so.

Seeing my code and reading you post I found that... yes, are a my fault!
I'm catching only an exception in a code/function definition, no its

Just modified my code to catch the exception *inside* the def and not
before and... now work!


More information about the Python-list mailing list