[XML-SIG] Using Installer with PyXML

Martin v. Loewis martin@mira.cs.tu-berlin.de
Sat, 20 Jan 2001 10:55:54 +0100


> "The problem here has to be the way that the xml library tree is replacing
> itself with the _xmlplus tree from the later PyXML distribution.  While
> runtime re-assigns xml to _xmlplus in the __init__ for xml, the import
> system used by the installation package can't track that, so it still looks
> for the actual module tree it loaded from the Python distribution beneath
> the name xml."

I'm not sure I understand the problem. Will the packager refuse (or
forget) to package the xml package, or will it, at runtime, fail to
load it?

If it manages to package both xml and _xmlplus: when loading xml, will
it execute xml/__init__.py? In there, there is an import of _xmlplus.
Will that succeed? If so, what happens to the lines

            import sys
            sys.modules[__name__] = _xmlplus

Will __name__ have a value of "xml"? Will the assignment succeed?

Now, suppose we do

from xml.sax import sax2exts

In normal Python, this will look for sys.modules["xml"] and start from
there. Are you saying the installer does not work that way, or that
even if it starts from there, it still can't figure out to load
_xmlplus.sax?

> So the question is, will this adversely impact normal Python operation, and
> is there a better way?

No, replacing the Python xml package completely with _xmlplus will
work just fine - except perhaps for the pyexpat difference.

> The other question I have is... Why are there two different pyexpat.pyd
> files, one as part of the core 2.0 distribution (at only 25 kb) and the
> other as part of the PyXML distribution in _xmlplus.parsers (at 124 kb). I
> haven't been able to get the large one to work using Installer, but the
> small core file works fine. What is the difference?

There are two differences: the one from PyXML contains a number of bug
fixes which are not in Python 2. In addition, it contains a literal
copy of the expat libraries, so that the expat DLLs in the Python core
should not be needed anymore.

When you say "get the large one to work", what exactly have you tried,
and how exactly did it fail?

Regards,
Martin