【问题标题】:App Engine Python: AttributeError: 'module' object has no attribute 'Stock'App Engine Python:AttributeError:“模块”对象没有属性“库存”
【发布时间】:2012-04-11 09:54:53
【问题描述】:

我只是在生产中遇到此错误。在 localhost 上运行良好。

Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/s~ordenaacoes/2.357768699674437719/controllers/mainh.py", line 74, in get
    'stocks': goodStocks(),
  File "/base/data/home/apps/s~ordenaacoes/2.357768699674437719/controllers/mainh.py", line 108, in goodStocks
    goodStocks = memcache.get("goodStocks")
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/memcache/__init__.py", line 574, in get
    results = rpc.get_result()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result
    return self.__get_result_hook(self)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/memcache/__init__.py", line 639, in __get_hook
    self._do_unpickle)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/memcache/__init__.py", line 271, in _decode_value
    return do_unpickle(value)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/memcache/__init__.py", line 412, in _do_unpickle
    return unpickler.load()
  File "/base/python_runtime/python_dist/lib/python2.5/pickle.py", line 852, in load
    dispatch[key](self)
  File "/base/python_runtime/python_dist/lib/python2.5/pickle.py", line 1084, in load_global
    klass = self.find_class(module, name)
  File "/base/python_runtime/python_dist/lib/python2.5/pickle.py", line 1119, in find_class
    klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Stock'

Stock 是我的模型之一。我也在 localhost 上使用 python 2.5 进行了测试。

给出错误的那一行是对 memcache 的访问(get 函数)。
我更改了项目,可能我放入 memcache 的数据类型不同。我有什么方法可以清理 memcache 上的数据吗?

有什么想法吗?

【问题讨论】:

  • 请包含产生此错误的实际代码的相关 sn-p。谢谢。

标签: python google-app-engine memcached


【解决方案1】:

从 1.6.4 版开始,管理控制台中有一个 Memcache 查看器。它包括一个“刷新缓存”按钮,应该可以满足您的需要。

【讨论】:

    【解决方案2】:

    很可能您在 memcache 中有一个与您的新代码不匹配的对象的腌制版本。这是关于刷新内存缓存的一个老问题,答案应该适用于您的情况:

    How can I have Google App Engine clear memcache every time a site is deployed?

    【讨论】:

      猜你喜欢
      • 2018-05-28
      • 2016-06-26
      • 2016-11-08
      • 2014-04-26
      • 2021-01-15
      • 2020-03-09
      • 2013-05-14
      • 2011-12-02
      相关资源
      最近更新 更多