当我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:


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

        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管理器;但希望对此有一个简单的解决方法。

最佳答案

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

except StyleError as e:


但是如果您要重新分发代码,则仍必须将其发送到上游。

08-27 18:06