1

当我from pgu import pgu as pgui得到以下异常时:

Traceback (most recent call last):
  File "C:/path/pyspace/main.py", line 3, in <module>
    from simulator.game import Game
  File "C:\path\pyspace\simulator\game.py", line 5, in <module>
    from simulator.guis.simulategui import SimulateGUI
  File "C:\path\pyspace\simulator\guis\__init__.py", line 2, in <module>
    from simulator.guis.simulategui import SimulateGUI
  File "C:\path\pyspace\simulator\guis\simulategui.py", line 5, in <module>
    from pgu import gui as pgui
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\pgu\gui\__init__.py", line 21, in <module>
    from .container import Container
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\pgu\gui\container.py", line 57
    except StyleError,e:

当我...\gui\container.py用 pycharm 打开时,有一个错误告诉我Python version 3.5 does not support this syntaxcontainer.pyin中的语法pgu如下:

        try:
            # This hack isn't perfect and so it's not enabled by default, but only by
            # themes that explicitly request it.
            alpha = pguglobals.app.theme.getstyle("pgu", "", "themealpha")
        except StyleError,e:
            alpha = False

我正在使用 pygame 1.9.2a0 和 pgu 0.18 运行 python 3.5.1。我是否需要为 pygame 安装不同版本的 pgu 或不同版本的 GUI 管理器,或者有没有简单的方法来解决这个问题?我假设我要安装一个不同的 GUI 管理器;但希望有一个简单的解决方法。

4

1 回答 1

1

看起来 pgu 仍在使用 Python 2.7 异常处理。您可以将本地副本更改为阅读

except StyleError as e:

但是如果您要重新分发代码,那仍然必须向上游发送。

于 2016-02-27T23:00:22.137 回答