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 \xe0\x00\x10JFIF\x00\x01\x01\x01\x01,\x01,\x00\x00\xff\xfe\x00 {FWv4-47_1, Tue Jul 18, 2006, 2:37:50 PM, 8G, 7710x10590, (1578+1912), 125%, Repro 2.2 v2, 1/100 s, R63.1, G54.9, B68.2\xff\xdb \x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r \x0c\x0b\x0b\x0c\x19\x12\x13\x0f\x14\x1d\x1a\x1f\x1e\x1d\x1a\x1c\x1c $. \' ",#\x1c\x1c(7),01444\x1f\'9=82<.342\xff\xc0\x00\x0b\x08\x00Z\x00= \x01\x01\x11\x00\xff\xc4\x00\x1a \x00\x00\x02\x03\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x03\x01\x05\x06\x04\x00\xff \xc4\x00A\x10\x00\x01\x03\x02\x04\x01\x07\t \x04\x08\x07\x00\x00\x00\x00\x00\x01\x02\x03\x11\x00\x04\x05\x12!1A \x06\x13Qaq\xc2\xd1\x14\x15"#2B\x83\x91\xa13\xb2\xc1\xf0$DRSr \x81\xe1\xf1bct\x82\x92\x93\xb1\xff\xda\x00\x08\x01\x01\x00\x00? \x00\xbf\xc4\xb1\xccM\x9b\xfb\xa8\xbeu\x08\x0f-)JN\x83S\x02\xb8\xd1\xca \x0can\x04\xaa\xea\xe4\x08\x9c\xc1\x7f\xd2\x8b\xcf\xb8\x8a\x94\x13\xe7+ \x82\xa3\xc0:I\xfaR\\\xc6\xf12\xe1Joo\x08N\xe7\xca\x145\xa6\'\x14\xbfX \x91\x88_\x1d?~\xaf\x1a\x95__+\xf5\xcb\xc3\xd3\xeb\xd5\xe3I]\xe3\xceBM \xed\xc9\xcc`E\xc2\x8e\xb1<[EMAIL PROTECTED] [EMAIL PROTECTED]'@ \'\xe7\xd94L\xd8)\xb6\xc9Y\xcf1\xb0\xe2&#\xa2\x96\xeb\x84-\xc1*L, \xa8\xf6S\xa5m0\x84\xa1*Qq\xbc\xa4\xfe\xcf_\xcdC\xe5B\xb6^t \x94\xb9\x9f!J\x92\x91\xa0L\xec\x0cxkR\x10Sx\xd6\xe6W\x9b(\x04\xc0\xcb \x97U\x1f\n\xdd\xf2\x18k\x88\t\xe2\xdfz\xa81\x04f\xc4o\x04\x81\xeb \xd7\xb8\x9fx\xd2\x92\x80\x94\x15Cd\xc7\xec\xeah\xfc\x95\xd2\x00\xca \xce\x9d\xa6\xb8\x1c\xe6\xd5t\x869\xb6\xd4\xe2\xd4\xa19DJbxu\x8a!x\xda [EMAIL PROTECTED] \x83I\xa3y\xa7\x9bA\\4\x02u\x84\xff\x00j\xd4r zx\x8f\xc3\xefU \x05\xf0\xcd\x89\xdd\xff\x00\xa8s\xef\x1aY\x1e\x87\x1d\xc7\x1a\xeaZ \x1fRT\x0bL\xaf]\x01Q\xdb\xe5\xbdR\xde\xb3r\x8b\xa5\xad\xbbb\x90\x16JT \x907)\x1b\x1e\xd1\xf5\xa5.\xd2\xe8:r[\x8el\x13\x92\x12$D\xe5\x8f\x9f \xe7Z\xee\xb0\xb5u.\xb8K\x01)\xf4\x82R\xa4\xc2r\xc8\t\xfaMt]\x07R \xc2\x81ChNC!$\x9dc\x86\x82\xb4\x9c\x89\x80\xe6#\xf0\xfb\xd5\x9e\xbd \x00\xe2Ws\x1fn\xe7\xde402\xeb\x04\xc8\xd7\xf9\xd3\x1e*. \x056\xe2\xb2\xe5\xd8\x1d\xe9\x0b\x0e\x91\xab\xea\x81\xac\xce\xf4\xd8\ \G\x95j{j\x02]\x8dn\xa7n\x9f\n\x07\x95\x16n!\xc73\xa8\x83\xae\xbd \x15\xa2\xe4v`\xee!\x03~o\xbdTW\xdabWpg\xf4\x874\x1c=#K9\xf2\xec\xad [EMAIL PROTECTED]> \x15 \xa93\xea\xc2`\x03\xe9(\x88\xeb;iB\xa0\xb5*r\'\xa3\xda\xa5> \x82\x1b\\\x84\xec}\xe0xV\xa3\x91\xc5Iv\xfe\x7f\xcb\xefVz\xf0N#u \xb4\xf3\xeb\xdf\xf8\x8dH\xf6\x00\xca\x9d\xc7OM5$\x04\x8e\xbd\x84h: \xa8NQ\xb9?APIB\x89Dm\xc4\xec\x7f\x1a\xf1Y\xf7`\xc7U%\xf5 (\xb6\xa1\xe8\xcc\x1d\x7f\x95h\xb9(\xa0\x97o\xbe\x1fz\xa8\xae \xc1\xf3\x95\xd6\xb3\xeb\x97$v\x9a\x803$\x1dw\x1b\xf6\xd3\xbd \x98\xf4\xa7\xb4p\xf9T\xe6\x91\xed\x8f\xf8\xff\x00J\rT\xef\xda\r \xba4\xa8\xcaF\xce\x89\x8f\xcf\nE\xc9W4\xafZ\x0e\x87J\xbe \xe4\xc1\x01\xcb\xcf\xf6w\xaa\x96\xf1\xd21K\xa22\x89}zp\xdc \xd7\x92\xb5\x14\x84\xe9\x970\xd8u\xd3.\\j \xd1\x92\xe2\x94\x846\x98\x04\x94\xed&6\x03\xa6\xb9\x8d \xfb2\x14\x16\x08:Hl\xef\xafWQ\xa9n\xf5\xa7\xdeJP\xb4\x97\x0fKg \xc2\x96\x8cI\x87a!\xd4\xca\x95\x94\x0el\xef1\xd1]\x0f\xa4\x8bu \x82\xa99O\x08\xab\x9eL\tv\xf6?\xc1\xde\xaa\x0b\xc3\x18\xad \xd8\x13\xf6\xee}\xe3^\xce\xa0$\x02cZ\x97\\/\xa4\xa5l\x856c2L \x19\x8aO4\x90\x9c\xa1\x94\xe5\xd3\xe8\x08\xfch\xd0\x84"\x14\x86P\x08 \x8d\xb8\x7fsHS\t\x19\xb2\xb0\xd2A\xea\x14\xc0\xf3\x8al \xa0\xa5:\x88\x076\xa0~5\xa7\xe4\x84)\xcb\xff\x00\x87\xde\xac\xa5\xea \x8aqK\xb4\x9d!\xf5\xc8?\xc4hR\xb0\x0e\xa4Gm\x17;[EMAIL PROTECTED] \xbac\x85HtD\x05\t\xa8.\xe9\xa2\x80;hhC\xa4{\xc3\xe7Z\x8eE\xb8\x14o\xcc \xfe\xef\xbdC\x8a[[\xab\x16|\x96\x1b$\x90L\xa0k \xa5\x15\xb5\x95\xa2\x86\xb6\xac\x9e\xd6\xc5[3\x86a\xe4&lm\x8e\x9cZO \x85v\'\t\xc3DF\x1fk\xff\x00J|(\xfc\xdb`\x0e\x96V\xc3\xe1\'\xc2\x8b \xc8m\x06\xd6\xac\x0f\x86*E\xb3\t\xf6Xlv Q%\xb47\xec!)\x9e\x81\x15\xff \xd9' (<type 'str'>) Any clue on how to fix this. Should I be doing a special encoding/ compression before placing the image file into the cache? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---