xml.dom.minidom + py2exe
Thomas Heller
thomas.heller at ion-tof.com
Fri Jul 13 03:33:20 EDT 2001
[posted and mailed]
"Trond Gaarder" <trondgaNOSPAM at student.matnat.uio.no> wrote in message news:9ilk1r$quo$1 at maud.ifi.uio.no...
> A small problem concerning py2exe that I hope you can help me with:
>
> I have a small OpenGL program that reads its scene graph from a XML file. I
> use xml.dom.minidom to accomplish this, and everything works fine. But when
> I try to compile the script into an .EXE with py2exe I get the following
> warnings:
>
> warning: py2exe:
> ***************************************************************
> warning: py2exe: * The following modules were not found:
> warning: py2exe: * xml.dom.HierarchyRequestErr
> warning: py2exe: * riscosenviron
> warning: py2exe: * _xmlplus
> warning: py2exe: * ic
> warning: py2exe: * ce
> warning: py2exe: * riscos
> warning: py2exe: * SOCKS
> warning: py2exe: * rourl2path
> warning: py2exe: * riscospath
> warning: py2exe:
> ***************************************************************
>
> And when I try to run the program:
>
> Traceback (most recent call last):
> File "<string>", line 381, in ?
> File "<string>", line 299, in readScenegraph
> File "SceneGraph.pyc", line 187, in fromXML
> File "xml\dom\minidom.pyc", line 910, in parse
> File "xml\dom\minidom.pyc", line 901, in _doparse
> File "xml\dom\pulldom.pyc", line 289, in parse
> File "xml\sax\__init__.pyc", line 88, in make_parser
> xml.sax._exceptions.SAXReaderNotAvailable: No parsers found
>
>
> It looks like the XML module is using som kind of dynamic loader (like Pmw
> does), and these modules naturally escape py2exe.
This is indeed the case:
C:\sf\py2exe\tests>c:\python20\python.exe
Python 2.0 (#8, Apr 25 2001, 22:09:02) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import xml
>>> xml
<module '_xmlplus' from 'c:\python20\_xmlplus\__init__.pyc'>
>>>
As you can see, 'import xml' actually loads _xmlplus and puts this
into sys.modules under the name 'xml'.
This can also be done by the packed executable, however, the _xmlplus
package must be available for this to work, and the bundling process
does not find it.
> Do any of you have any
> tips on how to work around this problem? Something similar to bundlepmw.py
> perhaps?
Use the -p command line flag 'python setup.py py2exe -p _xmlplus'
to include the whole _xmlplus package into the exe.
HTH,
Thomas
More information about the Python-list
mailing list