[Tutor] traceback

Kent Johnson kent37 at tds.net
Wed Jan 14 18:34:54 CET 2009


On Wed, Jan 14, 2009 at 12:09 PM, spir <denis.spir at free.fr> wrote:
> Hello,
>
> I rather often use exceptions as information providers at design or debug time. A typical use
> of mine is to have a test version of methods that wrap standard version:
>
> def run():
>        do stuff
>        that may
>        raise exc
> def testRun():
>        try:
>                run()
>        except Error,error:
>                sys.error.write(str(error))

I use traceback.print_exc() for this.

Kent


More information about the Tutor mailing list