Py2exe and name space package

Yuan HOng hongyuan1306 at gmail.com
Tue Jun 10 16:27:21 CEST 2008


On 6/10/08, Mike Driscoll <kyosohma at gmail.com> wrote:

>
> 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:
>

Thanks. When I modifed setup.py to include the 'includes' directive, as:

from distutils.core import setup
import py2exe

setup(name='test',
      zipfile=None,
      options={'py2exe': {'includes': ['zope.interface']}},
      console=[
          {
            'script': 'main.py',
          }
      ])


The build process will not finish with the following error:

C:\temp>python setup.py py2exe
running py2exe
*** searching for required modules ***
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    'script': 'main.py',
  File "c:\Python25\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "c:\Python25\lib\distutils\dist.py", line 974, in run_commands
    self.run_command(cmd)
  File "c:\Python25\lib\distutils\dist.py", line 994, in run_command
    cmd_obj.run()
  File "c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\build_exe.py",
line 223, in run
    self._run()
  File "c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\build_exe.py",
line 274, in _run
    self.find_needed_modules(mf, required_files, required_modules)
  File "c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\build_exe.py",
line 1189, in find_needed_modules
    mf.import_hook(mod)
  File "c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\mf.py",
line 649, in import_hook
    return Base.import_hook(self,name,caller,fromlist)
  File "c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\mf.py",
line 131, in import_hook
    m = self.load_tail(q, tail)
  File "c:\Python25\lib\site-packages\py2exe-0.6.6-py2.5-win32.egg\py2exe\mf.py",
line 197, in load_tail
    raise ImportError, "No module named " + mname
ImportError: No module named zope.interface

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

I will try this one.

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn


More information about the Python-list mailing list