[XML-SIG] lxml and py2exe

Stefan Behnel stefan_ml at behnel.de
Tue Jan 13 11:33:57 CET 2009


Hi,

the best place to ask this would have been comp.lang.python or the
(presumably existing) py2exe mailing list.

Jan Mewes wrote:
> I've a problem with lxml in an .exe file from py2exe. This is the
> error message:
>
> Traceback (most recent call last):
>   File "PyQuizzer.py", line 3, in <module>
>   File "zipextimporter.pyc", line 82, in load_module
>   File "questions.pyc", line 2, in <module>
>   File "zipextimporter.pyc", line 98, in load_module
>   File "lxml.etree.pyx", line 47, in lxml.etree (src/lxml/lxml.etree.c:
> 124316)
> ImportError: No module named _elementpath

I never used py2exe, but reading the post you referenced, I'd say the
problem is that _elementpath is imported from C code, so py2exe can't see
that it's used. Passing

    packages : ['lxml']

to py2exe should solve this. It will stuff more modules into the
executable than required, but it will also make sure nothing that *is*
required will get lost.

Stefan



More information about the XML-SIG mailing list