Problems creating an app with Py2exe

Don Dwiggins dwig at advancedmp.net
Fri Aug 3 14:23:07 EDT 2001


I have a little wxPython script that I want to package as an .exe.  I've
tried both py2exe and McMillan's installer, and was defeated both times.

This message is about my experience with Py2exe, version 0.2.6 (with
ActiveState Python 2.0.0.203).  I've included quite a bit of the gory
details, hoping that something may point to the problem.

The app uses wxPython (2.3) and the win32com client functions, in particular
Dispatch and gencache.EnsureDispatch.  It works fine when interpreted
directly.

I have the following setup file:
----------------------------------------------------------------------
import py2exe
from distutils.core import setup
import win32com.client

setup( name = "PartfinderMaint",
       scripts = ["PartfinderMaint.py"],
       packages = ['win32com.client']
       )
----------------------------------------------------------------------

I first tried "python PFMsetup.py py2exe --debug -w", but it stopped
partway through with the message:
  error: python20_d.dll: No such file or directory

After removing the "--debug", it completed with the following warnings:
----------------------------------------------------------------------
warning: build_py: package init file 'win32com\client\__init__.py'
          not found (or not a regular file)
warning: build_py: package init file 'win32com\client\__init__.py'
          not found (or not a regular file)
warning: install_lib: 'build\lib' does not exist -- 
         no Python modules to install
warning: install: modules installed to 
         'build\bdist.win32\winexe\lib\Python20\', which is not in
         Python's module search path (sys.path) -- you'll have to
         change the search path yourself
----------------------------------------------------------------------
(I've folded the lines by hand.)  Question: what file would I change to fix
the search path, and how would I change it?  Does this refer to the
distribution, or to something to be done on the target machine?

Trying to run it in the dist/PartfinderMaint directory, I get a traceback
that ends with the following:
----------------------------------------------------------------------
 File "win32com\client\gencache.pyc", line 430, in EnsureDispatch
 File "win32com\client\gencache.pyc", line 414, in EnsureModule
 File "win32com\client\gencache.pyc", line 231, in MakeModuleForTypelib
 File "win32com\client\makepy.pyc", line 261, in GenerateFromTypeLibSpec
 File "win32com\client\gencache.pyc", line 444, in AddModuleToCache
 File "win32com\client\gencache.pyc", line 468, in _GetModule
 File "imputil.pyc", line 117, in _import_hook
 File "<string>", line 60, in _finish_import
 File "imputil.pyc", line 294, in _load_tail
ImportError: No module named win32com.gen_py
----------------------------------------------------------------------
However, I see that it has built the gen_py subdirectory, and the package
with the right GUID for the component I'm calling:
----------------------------------------------------------------------
$ ls -R gen_py/
gen_py:
00000205-0000-0010-8000-00AA006D2EA4x0x2x5/  __init__.py  dicts.dat

gen_py/00000205-0000-0010-8000-00AA006D2EA4x0x2x5:
__init__.py
----------------------------------------------------------------------
... and __init__.py has the code for the component I'm calling.

Any help appreciated.

Thanks in advance,

-- 
Don Dwiggins                    "Solvitur Ambulando"
Advanced MP Technology
dwig at advancedmp.net





More information about the Python-list mailing list