Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 属性错误:';模块';对象没有属性';获取';memcache GAE_Python_Google App Engine_Caching_Memcached - Fatal编程技术网

Python 属性错误:';模块';对象没有属性';获取';memcache GAE

Python 属性错误:';模块';对象没有属性';获取';memcache GAE,python,google-app-engine,caching,memcached,Python,Google App Engine,Caching,Memcached,我有一个使用GAE的简单Python程序,我正在使用GAE的memcache模块来确保在更新缓存时不会出错: from google.appengine.api import memcache class NewPost(BlogHandler): def get(self): self.render("newpost.html") def post(self): #update cache for the front page

我有一个使用GAE的简单Python程序,我正在使用GAE的memcache模块来确保在更新缓存时不会出错:

from google.appengine.api import memcache

class NewPost(BlogHandler):
    def get(self):
        self.render("newpost.html")

    def post(self):

        #update cache for the front page
        val, unique = memcache.gets(FRONT_PAGE_KEY)
        for p in val:
            logging.warning(p)
现在,这段代码应该可以毫无问题地运行,但当我使用方法post时,它崩溃了:

Traceback (most recent call last):
  File "/home/pedro/google_appengine/google/appengine/runtime/wsgi.py", line 266, in Handle
    result = handler(dict(self._environ), self._StartResponse)
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 1519, in __call__
    response = self._internal_error(e)
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
    rv = self.handle_exception(request, response, e)
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
    return handler.dispatch()
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/home/pedro/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
    return method(*args, **kwargs)
  File "/home/pedro/google_appengine/hw6/blog.py", line 172, in post
    val, unique = memcache.gets(FRONT_PAGE_KEY)
AttributeError: 'module' object has no attribute 'gets'
INFO     2014-05-08 13:36:49,525 module.py:639] default: "POST /blog/newpost HTTP/1.1" 500 -
这毫无意义,特别是因为我知道memcache有一个名为
get(key)
的方法:

根据我对stackoverflow的研究,我发现了以下讨论:

因此,我刷新了缓存并删除了所有本地数据库的内容,但仍然收到错误


我做错了什么?

你搞错了:
memcache
模块没有
get
功能。看


gets
是memcache
Client
对象的一种方法:再次请参见。

您错了:
memcache
模块没有
gets
功能。看


get
是memcache
Client
对象的一种方法:再次请参见。

您需要更仔细地检查文档;模块函数:,不同于
客户端
类方法:您需要更仔细地检查文档;模块函数:,不同于
客户机
类方法:好吧,你的答案引导我走上了一条最终解决问题的道路!如果你愿意的话,你能问一下这个链接到你的答案吗?它真的解释了一切,我也得到了一些例子!我会在等待选择答案的时间结束后立即选择!好吧,你的回答引导我走上了一条最终解决我问题的道路!如果你愿意的话,你能问一下这个链接到你的答案吗?它真的解释了一切,我也得到了一些例子!我会在等待选择答案的时间结束后立即选择!