[Zope3-dev] Zope 3 needs pyexpat?

Fred L. Drake, Jr. fdrake@acm.org
Thu, 8 Aug 2002 11:45:53 -0400


Martijn Faassen writes:
 > I think someone reported a bug at the Charleroi sprint involving all this --
 > the expat situation is hopelessly confusing. I hope Python 2.3 will
 > document somewhere (at least) the One True Way to import Expat so it'll

There's only one documented way to import Expat now -- look in the
Library Reference, and you'll only find xml.parsers.expat.  Use that
for normal applications.  Use that for Zope.  Use it with or without
that PyXML.

This approach to the import has only one limitation:  If the import
fails and is tried again, the subsequent import will succeed, giving
you an empty module, so you get an AttributeError when accessing
specific contents of the module.  I've checked in a change for Python
2.2.2 (just this morning; no schedule or specific plans) so that
multiple attempts to import xml.parsers.expat will result in an
ImportError every time (which makes more sense); that is not needed
for PyXML 0.8 or newer or in Python 2.3 and newer, since they each
always provide their own pyexpat module.

 > all work. Currently the situation involves way way too much magic;
 > I believe PyXML even does not compile its own expat if it detects one
 > installed already, or something along those lines, adding further to
 > the absolute incomprehensibility of all this.

PyXML 0.8 always provides it's own pyexpat.

 > Yes, I've suffered with expat and python enough now to forget about being
 > pollite -- in my opinion this is a godawful mess.

I think the problem is completely fixed in PyXML 0.8 and Python 2.2.2
and 2.3.  Unfortunately, there's not schedule for either of the later
two.  Try upgrading to PyXML 0.8 if you're still having problems; that
was tested under Python 2.x, including (at least) 2.0.1, 2.1.3, 2.2.1,
and 2.3a0 (Python CVS current at the time of PyXML's release).


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation