[lxml-dev] _elementpath.pyc and py2exe problem

Greg Willden gregwillden at gmail.com
Fri Aug 31 17:56:11 CEST 2007


Hi Stefan,
That is the conclusion I came to as well.  The tool that searches for the
modules is called modulefinder and is a part of the standard library.
Modulefinder is unable to find _elementpath.* because it is only imported
from the C code.

My work-around was to add the following line to my code
import _elementpath as DONTUSE #this is a workaround for Modulefinder and
lxml

You may wish to do something similar in lxml.

It's not a matter of the .py versus .pyc because the executable (.exe) looks
for pre-compiled files when it is run.

Cheers,
Greg


On 8/31/07, Stefan Behnel <stefan_ml at behnel.de> wrote:
>
> Hi,
>
> Greg Willden wrote:
> > This is probably a question for py2exe developers but I'll ask it here
> too.
> >
> > I am trying to build a win32 .exe file with py2exe and it appears that
> > py2exe cannot locate _elementpath.pyc correctly.
> > The file does not get copied into the library.zip file.
> > I can manually (or programatically with python's zipfile module) add
> > _elementpath.pyc to the zip file and then the application works fine.
> >
> > Has anyone experienced this?  Any ideas why?
>
> I'm not sure, but it may be because the only module that imports
> _elementpath.py is lxml.etree, which is a C module. So maybe py2exe just
> lacks
> the information that the module actually is a hard dependency of the
> package.
>
> But I wonder why only the _elementpath.pyc file should be affected, not
> the
> _elementpath.py file. Don't the .py files get included at all?
>
> Stefan
>
>


-- 
Linux.  Because rebooting is for adding hardware.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20070831/7de9dd7d/attachment.htm 


More information about the lxml-dev mailing list