Py2exe and name space package

Mike Driscoll kyosohma at gmail.com
Tue Jun 10 15:14:15 CEST 2008


On Jun 10, 4:28 am, "Yuan HOng" <hongyuan1... at gmail.com> wrote:
> Hi,
>
> I used to freeze my application into Windows executibles using py2exe.
> Lately I started using several zope packages in my application, like
> zope.interface. Now the freezed program can't run properly. Like the
> following example shows:
>
> My setup.py file:
>
> from distutils.core import setup
> import py2exe
>
> setup(name='test',
>       zipfile=None,
>       console=[
>           {
>             'script': 'main.py',
>           }
>       ])
>
> The main.py test code:
>
> from zope.interface import Interface
> print Interface
>
> During the freezing process, the following warning is shown:
>
> *** copy dlls ***
> copying c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\run.exe
> -> C:\temp\dist\main.exe
> The following modules appear to be missing
> ['pkg_resources', 'zope.interface']
>
> Running main.exe gives me an import Error.
>
> C:\temp\dist>main.exe
> Traceback (most recent call last):
>   File "main.py", line 1, in <module>
> ImportError: No module named interface
>
> What should I do to make py2exe recognize and include zope.interface
> in the binary distribution?
>
> Thanks.
>
> --
> Hong Yuan
>
> 大管家网上建材超市
> 装修装潢建材一站式购物http://www.homemaster.cn


I include the lxml package in some of my programs and I do so by
adding the following to the setup.py

packages = ['lxml']

However, I'm not sure if what you want to add is truly a package.
Yours might go into the "includes" directive. Currently, I use the
GUI2Exe wrapper for py2exe as I find it easier to make complex
executables. You can find it here:

http://xoomer.alice.it/infinity77/main/GUI2Exe.html

Mike



More information about the Python-list mailing list