#1075: MemcachedStringEncodingError when using memcached sessions storage type
----------------------------------------------+-----------------------------
Reporter: Oleg Pudeyev <
ol...@bsdpower.com> | Owner: fumanchu
Type: defect | Status: new
Priority: normal | Milestone:
Component: CherryPy code | Keywords:
----------------------------------------------+-----------------------------
I set sessions storage type to memcached in production and received this
error as a result:
{{{
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/_cprequest.py", line 636, in
respond
self.hooks.run('before_request_body')
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/_cprequest.py", line 97, in run
hook()
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/_cprequest.py", line 57, in
__call__
return self.callback(**self.kwargs)
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/sessions.py", line 757, in
init
cherrypy.serving.session = sess = storage_class(id, **kwargs)
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/sessions.py", line 162, in
__init__
self._regenerate()
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/sessions.py", line 192, in
_regenerate
if self._exists():
File "/usr/local/lib/python2.7/site-
packages/CherryPy-3.2.0-py2.7.egg/cherrypy/lib/sessions.py", line 608, in
_exists
return bool(self.cache.get(
self.id))
File "build/bdist.freebsd-8.2-STABLE-i386/egg/memcache.py", line 793, in
get
return self._get('get', key)
File "build/bdist.freebsd-8.2-STABLE-i386/egg/memcache.py", line 761, in
_get
self.check_key(key)
File "build/bdist.freebsd-8.2-STABLE-i386/egg/memcache.py", line 945, in
check_key
"Keys must be str()'s, not unicode. Convert your unicode "
MemcachedStringEncodingError: Keys must be str()'s, not unicode. Convert
your unicode strings using mystring.encode(charset)!
}}}
OS is FreeBSD 8. Relevant packages installed:
{{{
py27-cherrypy-3.2.0
py27-memcached-1.47
python27-2.7.1_1
}}}
For now I set the storage type to ram as a workaround since I only have a
single process going.
--
Ticket URL: <
http://www.cherrypy.org/ticket/1075>
CherryPy <
http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework