1

I'm on Windows 7, as are all potential users of my program. I packaged a Python program I wrote into an executable file using cx_Freeze, with the following command:

python setup.py build

This generates a build directory that contains my_program.exe. The executable works flawlessly on my computer, but on a coworker's machine, it throws an exception:

ImportError: No module named 'zipfile'

Here's my setup.py, where zipfile is explicitly included (and it's definitely in library.zip):

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
   name='Z-Wizard',
   version='0.1',
   description='Z1/Z2 data extraction tool',
   author='Liz Rosa',
   author_email='me@url',
   options = {
      'build_exe': {
         'packages': ['zipfile']
      }
   },
   executables = [Executable('my_program.py', base=base)]
)

The traceback is quite long; there's a screenshot at the URL below. It apparently involves a series of functions in _bootstrap.py. I'm not quite sure what's going on here. Also, "C:\Users\lizr..." is my home directory, not hers. Why does it appear in the traceback on her computer? In case it's not obvious, I don't know much about the freezing process.

https://i.stack.imgur.com/Gjzjk.png

Liz Rosa
  • 11
  • 1
  • http://stackoverflow.com/questions/24716002/python3-pyqt4-cx-freeze-no-module-named-sip ? – Eric Levieil Sep 02 '15 at 22:25
  • Thanks for the suggestion, but it appears I'm using a newer version of cx_Freeze because that fix has already been applied. – Liz Rosa Sep 02 '15 at 23:21
  • I think it's normal for paths from your computer to appear in the traceback - those paths are kind of baked in when you freeze it. No idea why it would fail to find zipfile, though. – Thomas K Sep 03 '15 at 09:02
  • What are line 5 of Z_Wizard.py and line 2 of outputgenerator.py? The stacktrace looks like an infinite loop. Maybe you can create an issue at: https://bitbucket.org/anthony_tuininga/cx_freeze/issues?status=new&status=open – Eric Levieil Sep 03 '15 at 13:00
  • Those lines are `from outputgenerator import *` and `from xlsxwriter import *`, respectively. Xlsxwriter includes the line `from zipfile import ZipFile, ZIP_DEFLATED`, so that's where the zipfile module requirement originates. I expanded the .exe produced by py2exe and verified that zipfile.pyc is included inside. I can't figure out why bootstrap wouldn't be able to find it... – Liz Rosa Sep 03 '15 at 15:07

0 Answers0