[Zope-dev] Better diagnostics during product load?

Bill Anderson bill.anderson@libc.org
Mon, 21 Feb 2000 18:35:53 -0700


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
-- 
In flying I have learned that carelessness and overconfidence are 
usually far more dangerous than deliberately accepted risks. 
          -- Wilbur Wright in a letter to his father, September 1900