首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Python3.3Path奇怪错误:'NoneType‘对象没有属性’cx_freeze‘

Python3.3Path奇怪错误:'NoneType‘对象没有属性’cx_freeze‘
EN

Stack Overflow用户
提问于 2013-03-05 09:03:30
回答 1查看 1.6K关注 0票数 0

所以,这就是我的问题。

我正在用Pygame和Python 3.3制作一个游戏,使用的是Ubuntu 12.10。很好。我将把一堆Python脚本捆绑到一个可执行文件中,然后分发它。也很好。我选择使用cx_freeze,因为我使用的是Python3,所以没有其他选择。

这就是我的问题所在。我用谷歌搜索过,但还没见过这样的东西。我的setup.py如下:

代码语言:javascript
运行
复制
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如下:

代码语言:javascript
运行
复制
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行是这样的;

代码语言:javascript
运行
复制
  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。现在,最后一行很突出,因为在谷歌上搜索它什么也没发现。我不知道subModule在哪里可以成为None,而且我也不能轻易地检查,因为cx_freeze有垃圾文档。

我从来没有真正使用过cx_freeze或distutils,所以我不知道我到底在做什么!任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-08 02:35:15

深入研究了这一点,这是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的默认设置。在13.04中,Python 3.3将成为默认设置。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15214020

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档