Importing XML modules in py2exe or Installer?

Thomas Heller thomas.heller at ion-tof.com
Sat Jul 14 14:58:17 EDT 2001


> Have completed a fairly large project where I, among other modules, use the
> Python XML package from the XML SIG. Now I want to make a DOS binary to
> distribute it as a standalone application for Windows users.
>
> Neither py2exe nor Installer is able to find the XML modules by themselves,
> and I haven't been able to figure out how to include them. For example,
> when running the EXE that Installer creates, I get the following message:
>
> Traceback (most recent call last):
>   File "<string>", line 7, in ?
>   File "E:\pyinst\support\imputil.py", line 117, in _import_hook
>     return importer._finish_import(top_module, parts[1:], fromlist)
>   File "E:\pyinst\support\imputil.py", line 206, in _finish_import
>     bottom = self._load_tail(top, parts)
>   File "E:\pyinst\support\imputil.py", line 292, in _load_tail
>     m = self._import_one(m, part, fqname)
>   File "E:\pyinst\support\imputil.py", line 252, in _import_one
>     module = self._process_result(result, fqname)
>   File "E:\pyinst\support\imputil.py", line 281, in _process_result
>     exec code in module.__dict__
>   File "e:\python\lib\xml\dom\minidom.py", line 21, in ?
>     from xml.dom import HierarchyRequestErr
>   File "E:\pyinst\support\imputil.py", line 117, in _import_hook
>     return importer._finish_import(top_module, parts[1:], fromlist)
>   File "E:\pyinst\support\imputil.py", line 206, in _finish_import
>     bottom = self._load_tail(top, parts)
>   File "E:\pyinst\support\imputil.py", line 294, in _load_tail
>     raise ImportError, "No module named " + fqname
> ImportError: No module named _xmlplus.dom
>
> The XML modules reside at e:\python\_xmlplus in this computer. I have tried
> the respective include options, but don't know if I do it right:
>
> python e:\pyinst\builder.py myscript.cfg --includes e:\python\_xmlplus
>
The correct py2exe command line would be (assuming your script is
named setup.py):
'python setup.py py2exe -p _xmlplus'
to include the whole _xmlplus package.

Hope this helps,

Thomas





More information about the Python-list mailing list