On Thu, Nov 20, 2008 at 6:00 PM, bfrederi <[EMAIL PROTECTED]> wrote: > > I am trying to cache a small thumbnail image. The code is a bit > extensive, but the part this is breaking is that I am opening the > image file, then this: > > cache.set('thumbnail_file', image_file.read()) > > when I go to retrieve the image with: > > cache.get('thumbnail_file') > > I get this traceback: > > Traceback (most recent call last): > File "/home/django-code/aubrey_ark/tests.py", line 48, in > testResourceObject > ro = ResourceObject(self.meta_id) > File "/home/django-code/aubrey_ark/resource_handler.py", line 102, > in __init__ > cache.get(self.meta_id+'_thumbnail') > File "/usr/lib/python2.5/site-packages/django/core/cache/backends/ > memcached.py", line 30, in get > return smart_unicode(val) > File "/usr/lib/python2.5/site-packages/django/utils/encoding.py", > line 35, in smart_unicode > return force_unicode(s, encoding, strings_only, errors) > File "/usr/lib/python2.5/site-packages/django/utils/encoding.py", > line 70, in force_unicode > raise DjangoUnicodeDecodeError(s, *e.args) > DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xff in > position 0: unexpected code byte. You passed in '\xff\xd8\xff... > [...] > > Any clue on how to fix this. Should I be doing a special encoding/ > compression before placing the image file into the cache? >
See tickets #9180 and #5589 for related reports and proposed workarounds/fixes when using the memcache backend. Regards, -- Ramiro Morales --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---