Suppressing Implicit Chained Exceptions (Python 3.0)

andrew cooke andrew at
Wed Jul 1 13:42:06 EDT 2009

I have some (library) code where an exception is caught and, since the
underlying cause is rather obscure, a different exception is raised that
more clearly explains the issue to the caller.

However, when printed via format_exc(), this new exception still has the
old exception attached via the mechanism described at (this is Python 3.0).

Is there any simple way to stop this?  It's rather annoying and
misleading, as it exposes a lot of internal detail that the caller does
not understand or want.  This is marked as an "open issue" in the PEP
described above.


More information about the Python-list mailing list