所以我刚升级到小牛队,我突然遇到各种各样的错误:
大部分都是这样的:
Cannot define property using reserved word 'requests'.
我们也看到了其他属性。它们都不是实际上保留的单词而且它们都被定义了一次(因此它不是因为它们在同一个对象上或通过ReferenceProperty字段是重复的属性)
我们没有改变任何东西(除了操作系统升级)。我们在app引擎日志Python command: /usr/bin/python2.7
中使用python2.7,我们在app.yaml中指定了python27
此应用程序(具有相同的属性名称)已存在多年,因此不确定发生了什么。我曾经试图在Linux机器上设置它,但是当时就放弃了。但是这一次,它是我的主要开发机器。
有什么想法吗?
更长的错误:
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 515, in __init__
_initialize_properties(cls, name, bases, dct)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 425, in _initialize_properties
check_reserved_word(attr_name)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 319, in check_reserved_word
"definition." % locals())
ReservedWordError: Cannot define property using reserved word 'requests'.
If you would like to use this name in the datastore consider using a different
name like requests_ and adding name='requests' to the parameter list of the
property definition.
更新:降级到2.7.2似乎可以解决所有问题。
答案 0 :(得分:0)
您应该查看“check_reserved_word”的来源 我抓住了最新的&看了python / google / appengine / ext / db / _ init _py
不 请求是一个Python保留字,现在 GoogleAppEngine 保留了请求。
if attr_name in _RESERVED_WORDS or attr_name in dir(Model):
raise ReservedWordError(
"Cannot define property using reserved word '%(attr_name)s'. "
"If you would like to use this name in the datastore consider "
"using a different name like %(attr_name)s_ and adding "
"name='%(attr_name)s' to the parameter list of the property "
"definition." % locals())
如果您对AppEngine如何使用“请求”感到好奇,您应该查看 _RESERVED_WORDS 的设置位置,以及 dir(型号)的内容。