I am using Python 2.7.8.

I installed the following: py2exe-0.6.9.win32-py2.7.exe and pywinusb-0.3.3

I have a script that I am trying to run. When I do I get the following error:

C:\Python27\MyScripts\VMS\Python_Firmware_Upgrader-4_00_02\Python_Firmware_Upgrader\python-msp430-tools\win32>python ./setup-combined-tools
changed directory to C:\Python27\MyScripts\VMS\Python_Firmware_Upgrader-4_00_02\Python_Firmware_Upgrader\python-msp430-tools
running py2exe
*** searching for required modules ***
Traceback (most recent call last):
  File "./setup-combined-tools-py2exe.py", line 47, in <module>
    zipfile = "lib/shared.zip",
  File "C:\Python27\lib\distutils\core.py", line 151, in setup
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 296, in _run
    self.find_needed_modules(mf, required_files, required_modules)
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 1297, in find_needed_modules
  File "C:\Python27\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Python27\lib\site-packages\py2exe\mf.py", line 136, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "C:\Python27\lib\site-packages\py2exe\mf.py", line 204, in find_head_package
    raise ImportError, "No module named " + qname
**ImportError: No module named pywinusb**

A portion of my setup script is shown below:

    name = 'http://mspgcc.sourceforge.net',
    author="Chris Liechti",

    version = '0.6',
    options = { "py2exe":
            'dist_dir': 'bin',
            'excludes': ['javax.comm', 'macpath', 'TERMIOS', 'FCNTL',
                    'os2emxpath', '_parjtag',
                    'IronPythonConsole', 'System', 'System.IO.Ports',      'System.Windows.Forms.Clipboard', 'clr',
                'modes.editingmodes', 'startup', 'Carbon', 'Carbon.Files', 'wx'],
            'packages': ['msp430', 'msp430.asm', 'msp430.memory', 'msp430.shell',
                    'msp430.gdb', 'msp430.jtag', 'msp430.bsl', 'msp430.bsl5', **'pywinusb'**],
            'includes': ['pywinusb', 'EasyDialogs'],
            'dll_excludes': ['HIL.dll', 'MSP430.dll', 'MSP430mspgcc.dll'],
            'optimize': 2,
    console = [
    windows = [
            'script': "scripts/msp430-downloader.py",
            'icon_resources': [(0x0001, 'win32/downloader.ico')]
    zipfile = "lib/shared.zip", 

I found the following link:


Basically it says => py2exe does not currently (as of 0.6.5) work out of the box if some of your program's dependencies are in .egg form

When I ran the pywinusb setup.py as follows

python setup.py install_lib

I got the uncompressed folder => C:\Python27\Lib\site-packages\pywinusb

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.