当我的 django 应用程序尝试从缓存中获取或存储某些内容时,有时会出现以下错误:
c = cache.get(pk)
File "/opt/python3/lib/python3.4/site-packages/django/core/cache/__init__.py", line 131, in __getattr__
return getattr(caches[DEFAULT_CACHE_ALIAS], name)
File "/opt/python3/lib/python3.4/site-packages/django/core/cache/__init__.py", line 113, in __getitem__
cache = _create_cache(alias)
File "/opt/python3/lib/python3.4/site-packages/django/core/cache/__init__.py", line 88, in _create_cache
return backend_cls(location, params)
File "/opt/python3/lib/python3.4/site-packages/django/core/cache/backends/memcached.py", line 185, in __init__
value_not_found_exception=pylibmc.NotFound)
AttributeError: 'module' object has no attribute 'NotFound'
但为什么?该模块具有该属性,并且大多数时候它都可以工作,没有同名的文件可以破坏这个,在哪里寻找这个原因?
>>> import pylibmc
>>> pylibmc.NotFound
<class '_pylibmc.NotFound'>
>>>