[Zope] Print error_traceback from script (python)
Dieter Maurer
dieter@handshake.de
Sat, 12 Jan 2002 19:50:00 +0100
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).
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.
Dieter