Capturing exceptions?

Michael Hudson mwh at python.net
Wed Aug 25 13:23:51 EDT 2004


Dfenestr8 <chrisdewinN0SPAM at yahoo.com.au> writes:

> Hi.
> 
> What's the easiest way to capture the traceback from an exception, and
> write it to a file? Ideally, I'd like to be able to do something like:
> 
> >try:
> >	main()
> >except:
> >	write the traceback to a file

Read up on the traceback module.

Cheers,
mwh

-- 
6. Symmetry is a complexity-reducing concept (co-routines include
   subroutines); seek it everywhere.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list