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
Google app engine 谷歌应用引擎1.7.6 memcache查看器(Python)_Google App Engine_Python 2.7_Memcached_Pickle - Fatal编程技术网

Google app engine 谷歌应用引擎1.7.6 memcache查看器(Python)

Google app engine 谷歌应用引擎1.7.6 memcache查看器(Python),google-app-engine,python-2.7,memcached,pickle,Google App Engine,Python 2.7,Memcached,Pickle,在将PythondevAppServer更新为GoogleAppEngine1.7.6(使用Python2.7)之后,我在memcache查看器方面遇到了一些问题 我的memcache似乎未更新或不可读。我曾尝试使用app engine memcache viewer查看memcache,但当我输入memcache密钥时,出现错误 当我刷新缓存时,一切正常进行,直到需要再次读取memcache 命中率和memcache大小会正常增加,因此缓存中有一些内容。另外,当我回到AppEngine1.7.

在将PythondevAppServer更新为GoogleAppEngine1.7.6(使用Python2.7)之后,我在memcache查看器方面遇到了一些问题

我的memcache似乎未更新或不可读。我曾尝试使用app engine memcache viewer查看memcache,但当我输入memcache密钥时,出现错误

当我刷新缓存时,一切正常进行,直到需要再次读取memcache

命中率和memcache大小会正常增加,因此缓存中有一些内容。另外,当我回到AppEngine1.7.5时,一切正常。也许其他人也有这个问题

当我输入memcache键时,我得到以下结果:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\admin\admin_request_handler.py", line 80, in dispatch
    super(AdminRequestHandler, self).dispatch()
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\admin\memcache_viewer.py", line 145, in get
    values['value'], values['type'] = self._get_memcache_value_and_type(key)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\admin\memcache_viewer.py", line 74, in _get_memcache_value_and_type
    except (pickle.UnpicklingError, AttributeError, EOFError, ImportError,
NameError: global name 'pickle' is not defined
我试图在main.py中包含一个“import pickle”,但这是徒劳的

我已经包括了一些我的代码示例,但希望这不是必需的,我希望它更多地与应用程序引擎更新有关,而不是我的代码

我的一些main.py文件:

#import pickle
from google.appengine.api import memcache
from google.appengine.ext import db
还有一个关于如何处理memcache的示例函数:

def mc_get(key):
    a = memcache.get(key)
    if a:
        val = a
    else:
        val = None
    return val

def mc_set(key, val):
    memcache.set(key, val)
如果我想查询数据库中的用户,我会使用:

def get_users(update=False):
    mc_key = 'USERS'
    entries = mc_get(mc_key)
    if update or entries is None:
        a = User.all()
        logging.error('DB---Q - Users')
        entries = list(a)
        memcache.set(mc_key, entries)
    return entries
更新: 我在Google\Google\u appengine\Google\appengine\tools\devappserver2\admin\memcache\u viewer.py中的memcache\u viewer.py文件中添加了“import pickle” (这是一只虫子吗??)

现在,当我输入memcache密钥时,在memcache密钥输入字段下出现以下错误: 获取用户时出错:无法从缓存中检索值:没有名为main的模块


任何帮助都将不胜感激,提前感谢。

我将旧的数据存储API更改为NDB(更改代码有点麻烦)。自动缓存似乎已经解决了问题,这可能表明问题出在我的代码上,但仍然无法解释为什么在使用AppEngine1.7.5而不是1.7.6时,一切都很好


如果有人有其他选择,我会删除这个答案,我只是想发布我的进度,以防其他人也有同样的问题。

我已经尝试修改C:\Program Files(x86)\Google\Google\Google\U appengine\Google\appengine\tools\devappserver2\admin\memcache\U viewer.py中的memcache\u viewer.py文件,但我在权限方面遇到了困难。。。但是我很难相信1.7.6中的更新会要求我在一个源文件中包含一些内容,我在使用1.7.5时没有添加import pickle这肯定是一个bug。当您存储更复杂的结构(我认为是对象,但没有完全测试)时,就会发生这种情况。我用memcached字符串和字典做了一些简单的测试,效果很好。我受够了最近所有的bug。你应该在谷歌应用引擎的问题跟踪器中发布这个-好的,很酷,我会将它发布到谷歌应用引擎的问题跟踪器中,谢谢你的输入。我一直在玩部署的应用程序,它相当易变,仍然没有找到解决方案。如果有解决方案,我会发布。