lxml and py2exe

View: New views
2 Messages — Rating Filter:   Alert me  

lxml and py2exe

by Bugzilla from jan-mewes@web.de :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
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've tryed to build a minimal file but it doen't cause this problem.
but there is no error-message. It simply closes the console.

I've found a similar problem in the archives of lxml-dev but I don't
understand the solution.
http://codespeak.net/pipermail/lxml-dev/2007-August/002909.html
Would you be so kind to explain it to me, if you 've got it?

Thanks in advance!
Jan
_______________________________________________
XML-SIG maillist  -  XML-SIG@...
http://mail.python.org/mailman/listinfo/xml-sig

Re: lxml and py2exe

by Stefan Behnel-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

_______________________________________________
XML-SIG maillist  -  XML-SIG@...
http://mail.python.org/mailman/listinfo/xml-sig