[Zope] Print error_traceback from script (python)

Tim Hicks timNOT_THIS@sitefusion.co.uk
Sat, 12 Jan 2002 21:32:46 -0000


> Tim Hicks writes:
>  > I have a script (python) that has various try/except clauses in it.  I
would
>  > like to be able to get hold of the traceback from within the except
block so
>  > that I can (optionally) send it as an argument to a user-friendly page
>  > summarising how the last lot of transactions went.
> The "README" tab in the PythonScripts product description
> (of, if you prefer, the corresponding file in "Products/PythonScripts")
> tells you how to make modules and functions available in
> PythonScripts (i.e. lose security restrictions).

Yup, I've read about this.

> To print the traceback, you need "sys.exc_info" and functions
> from the traceback module (e.g. "print_exception"). Look
> at the Python documentation, for details.

OK.  I thought (hoped) I would be able to get hold of the traceback without
going through this because standard_error_message can do it, and I found
threads on the list about using <dtml-var error_traceback>.

Can I just say at this point (to anyone who's listening) that it would be
quite a handy feature (for me anyway) to be able to do this without having
to allow the import of extra modules :-).

thanks for your help again Dieter,

tim