2014-02-22 1 views
1

32 비트 Ubuntu에서 cx_freeze를 사용하여 첫 번째 .exe 파일을 만들려고 시도하지만 설명 할 수없는 TypeError가 발생했습니다. 설치 파일에서 뭔가 잘못되었지만 아직 무엇이 있는지 찾아야 할 것으로 예상됩니다.cxfreeze를 사용할 때 TypeError

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 내가 나 자신이 여러 가지 유용한 기능을 포함 쓴 모듈은) 내가 터미널에서 명령을 실행했습니다있다 :

python setup.py build 
다음은 설치 스크립트입니다 내가 그 명령을 입력하면

, 나는 다음과 같은 오류 메시지가 :

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 
지금까지 내가, 내가했습니다 말할 수

cx_freeze 문서를 충실히 따랐습니다.

답변

0

저는 cx_freeze 전문가는 아니지만 실행 파일 정의가 잘못되었습니다. packages 인수 (즉 __init__.py와 0 개 이상의 다른 파이썬 파일이 들어있는 폴더) 패키지의 목록을하도록되어하지 파이썬의 모듈 (개별 .py 파일). 모듈과 패키지의 차이점에 대한 자세한 내용은

, 사실,`packages`뿐만 아니라 모듈을 취할 수 http://docs.python.org/2/tutorial/modules.html

+0

볼은 - 명명은 다소 혼란 -하지만 * *은'.py'가 없어야합니다 신장. –

관련 문제