I am attempting to make my first .exe file using cx_freeze on 32-bit Ubuntu, but am encountering an unexplained TypeError. I expect I have done something wrong in my setup file, but have yet to find what it might be. Here is the setup script:
import sys
from cx_Freeze import setup, Executable
exe = Executable(
script = 'cornell7.py',
targetName = 'cornell7.exe',
packages = ['header2.py'],
targetDir = 'executable_dir',
includes = [ 'urllib.request', 'socket', 'sys', 'string', 'threading', 'time','datetime'],
copyDependentFiles = True
)
setup( name = 'cornell7.exe',
executables = [exe]
)
(header2.py is a module I myself wrote containing several useful functions)
Here is the command I've been running in the terminal:
python setup.py build
When I enter that command, I get the following error message:
running build
running build_exe
Traceback (most recent call last):
File "setup.py", line 14, in <module>
executables = [exe]
File "/usr/lib/pymodules/python2.7/cx_Freeze/dist.py", line 278, in setup
distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/pymodules/python2.7/cx_Freeze/dist.py", line 165, in run
freezer.Freeze()
File "/usr/lib/pymodules/python2.7/cx_Freeze/freezer.py", line 405, in Freeze
self._FreezeExecutable(executable)
File "/usr/lib/pymodules/python2.7/cx_Freeze/freezer.py", line 149, in _FreezeExecutable
scriptModule = finder.IncludeFile(exe.script, exe.moduleName)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 391, in IncludeFile
deferredImports)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 286, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 353, in _ScanCode
module, relativeImportIndex)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 176, in _ImportModule
deferredImports)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 246, in _InternalImportModule
parentModule)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 286, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 353, in _ScanCode
module, relativeImportIndex)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 176, in _ImportModule
deferredImports)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 241, in _InternalImportModule
fp, path, info = self._FindModule(searchName, path)
File "/usr/lib/pymodules/python2.7/cx_Freeze/finder.py", line 84, in _FindModule
for location in path:
TypeError: 'NoneType' object is not iterable
So far as I can tell, I've obeyed the cx_freeze documentation faithfully.