[Zope-dev] Better diagnostics during product load?

Loren Stafford lstaffor@dynalogic.com
Mon, 21 Feb 2000 18:41:51 -0800


> Loren Stafford wrote:
> >
> > > > 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
> >
> > Thanks for your suggestion. I tried that, but it didn't help -- same
result.
> > If there's a syntax error in the module, Python won't even execute the
> > "try...except", will it?
>
>
> Taking a look at gtk's Boring Product documentation. In there is a
> method for getting the traceback information into Zope, to see when you
> click on the broken product in the products screen.
>
> http://www.Zope.org/Members/gtk/Boring/HowTo-Boring
>
> That should help.
>
> Bill

I'm already doing that. Strangely enough, the product does not show up as
broken on the products screen -- it looks like a normally installed product.
But it clearly is not installed: 1. Zope said it didn't install 2. It's
private objects weren't created 3. It left no entries in the zLOG other than
the standard ones and the one mentioned above (I have logging calls at each
step in it's installation, including one as the first statement of
initialize(context)).

So the problem is how to get some debug info BEFORE Zope tries to execute
initialize().

-- Loren