使用Python的TideSDK:除了e:…使TideSDK使用python2.7

2024-05-08 21:34:07 发布

您现在位置:Python中文网/ 问答频道 /正文

编辑:

我刚刚注意到TideSDK使用python2.5(它在SDK中提供),并且我使用的这个语法在那个版本中确实是无效的语法。在

现在的问题是,如何让TideSDK使用python2.7?在


我使用的是tidesdk1.3.1-beta和tidesdkdeveloper(1.4.2)。在

我想用TideSDK编写一个桌面应用程序并嵌入一些python代码。在

当我在Python中使用“Exception as x”编写代码时,例如:

try:
    pass
except Exception as x:
    pass

我收到以下错误(如Webkit“Web Inspector”控制台中所示),代码无法运行:

^{2}$

我尝试了内联代码和插入代码,但仍然得到相同的错误。在

内联代码:

<script type="text/python">
    try:
        pass
    except Exception as x:
        pass

插入代码:

<script type="text/python" src="test.py"></script>

我可以使用:

except Exception:
    pass

但不是:

except Exception as x:
    pass

出什么问题了吗?在


Tags: 代码text版本编辑astype错误exception