簡體   English   中英

Python 3.3 cx_freeze奇怪的錯誤:“ NoneType”對象沒有屬性“ path”

[英]Python 3.3 cx_freeze weird error: 'NoneType' object has no attribute 'path'

所以,這是我的問題。

我正在使用Ubuntu 12.10在Pygame和Python 3.3中進行游戲。 精細。 我將把一堆Python腳本捆綁到一個可執行文件中,然后分發它。 還可以 我要使用cx_freeze,因為自從我使用Python 3以來,我沒有其他選擇。

這就是我的問題所在。我已經在Google周圍搜索了,但是沒有看到類似的東西。 我的setup.py如下:

from cx_Freeze import setup, Executable
import sys

includes = ['sys', 'pygame.display', 'pygame.event', 'pygame.mixer', 'core', 'game']

build_options = {
                 'optimize' : 2,
                 'compressed': True,
                 'packages': ['pygame', 'core', 'game'],
                 'includes': includes,
                 'path': sys.path + ['core', 'game'],
                 }

executable = Executable('__init__.py',
                        copyDependentFiles=True,
                        targetDir='dist',
                        )

setup(name='Invasodado',
      version='0.8',
      description='wowza!',
      options = {'build_exe': build_options},
      executables=[executable])

我的__init__.py如下:

from sys import argv

import pygame.display
import pygame.event
import pygame.mixer

pygame.mixer.init()
pygame.display.init()
pygame.font.init()

from core import gsm

#Omitted for brevity

我的其余代碼(包括完整的__init__.py )可以在https://github.com/CorundumGames/Invasodado中找到(如果相關)。

我得到了一個長屁股堆棧跟蹤,可以在這里http://pastebin.com/Aej05wGE找到。 它的最后10行是這樣;

  File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 421, in _RunHook
    method(self, *args)
  File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/hooks.py", line 454, in load_scipy
    finder.IncludePackage("scipy.lib")
  File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 536, in IncludePackage
    self._ImportAllSubModules(module, deferredImports)
  File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 211, in _ImportAllSubModules
    recursive)
  File "/usr/local/lib/python3.3/dist-packages/cx_Freeze/finder.py", line 209, in _ImportAllSubModules
    if subModule.path and recursive:
AttributeError: 'NoneType' object has no attribute 'path'

如果相關,我將使用Pydev和Eclipse。 現在,最后一行脫穎而出,因為在Google上搜索沒有任何內容。 我不知道subModule可能在哪里變成None ,並且我不容易檢查,因為cx_freeze有屎文檔。

我以前從未真正使用過cx_freeze或distutils,所以我不知道我在做什么! 任何幫助將不勝感激。

對此進行了研究,這是cx_Freeze中的一個錯誤,該錯誤僅在自安裝PEP 3149以來具有多個Python版本時才會發生-即在3.3之前不會出現。

我已經提交了一個錯誤報告: https : //bitbucket.org/anthony_tuininga/cx_freeze/issue/22/error-when-scanning-for-modules-with-a

同時,您現在可以通過使用Python 3.2避免該問題,因為這是Ubuntu 12.10中的默認設置。 Python 3.3將是13.04中的默認設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM