当我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 syntax
。 container.py
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管理器;但希望有一个简单的解决办法。
答案 0 :(得分:1)
看起来pgu仍在使用Python 2.7异常处理。您可以将本地副本更改为
except StyleError as e:
但如果您重新分发代码,则仍需要向上游发送。