[Zope-dev] configuration error

Dieter Maurer dieter at handshake.de
Sun Aug 24 02:50:22 EDT 2008


Bristow Thankachan wrote at 2008-8-23 15:53 +0530:
>We are stuck with a configuration error in porting zope2 to python2.5. Can
>anybody help us in fixing configuration error in the module Zope2.  The full
>log of error message is given below.
> ...
>  File "/home/zope/ztrunk25/lib/python/ZConfig/cfgparser.py", line 57, in
>parse
>    section = self.end_section(section, line[2:-1])
>  File "/home/zope/ztrunk25/lib/python/ZConfig/cfgparser.py", line 112, in
>end_section
>    self.error(e[0])
>  File "/home/zope/ztrunk25/lib/python/ZConfig/cfgparser.py", line 177, in
>error
>    raise ZConfig.ConfigurationSyntaxError(message, self.url, self.lineno)
>ConfigurationSyntaxError: invalid warning category:
>'Zope2.Startup.tests.test_warnfilter.TestSchemaWarning' (line 8)

I can only partially help you.

Unfortunately, "ZConfig" is *VERY* bad with respect to the help
it provides to understand the causes of so called "configuration problems":

   It turns all exceptions (configuration problems or else) into
   "ConfigurationError"s and in this process cuts of valuable
   tracebacks.

   Thus, we have heavy loss of information that would be helpful
   to analyse problems occuring during configuration but that
   are not configuration errors (but some import problems,
   or incompatibilities with the Python version as in your case).

   Very bad design in this respect....


When I meet such a case ("ZConfig" stupidly tells me about a
"ConfigurationError" which is not (primarily) a configuration error),
I temporarily change the "ZConfig" source:

  At places

     try: ....
     except ....:
       ....
       raise ...ConfigurationError(...)

I add a "raise" line before the "raise ...ConfigurationError()".
By this, I get the original exception and especially the
original traceback and then can usually quickly find the original
problem.


In your special case, some quessing may give a faster result.

It is likely that the original problem comes from
"Zope2.Startup.warnfilter.warn_category".
You can put a breakpoint there and then determine by single stepping
the cause.


An additional guess may give even a faster result.
Problably the following lines are to blame:

    if (not isinstance(cat, types.ClassType) or
        not issubclass(cat, Warning)):
        raise ValueError("invalid warning category: %s" % `category`)

Almost surely, Python made its "Warning" class a new style class
such that "isinstance(cat, types.ClassType)" fails now.


-- 
Dieter


More information about the Zope-Dev mailing list