[Zope-dev] Better diagnostics during product load?

Jonothan Farr jfarr@real.com
Mon, 21 Feb 2000 16:26:40 -0800


> Often, when Zope tries to load my product, it logs the simple error message:
>     2000-02-21T23:51:57 ERROR(200) Zope Couldn't install MyProduct
> There is no traceback, not in the log and not in the product screen of the
> Control Panel. I presume the problem is syntax errors in the Python code of
> the product.
>
> How can I get Zope to show me a traceback pointing out the syntax errors?


In the __init__.py for your product, use a try: except to print out the
traceback.

try:

    <product initialization here>

except:
    import traceback
    traceback.print_exc()


This will print the traceback to stderr.

-jfarr

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi! I'm a signature virus.
Copy me into your .sig to join the fun!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~