UnicodeDecodeError when I try to put image data to response

I get the image (png) data from db, then I got a UnicodeDecodeError

o = self.resp.out
pic=QuickView.get_by_key_name(hash)
h['Content-Type'] = 'image/' + img_type
o.write(pic.data)

#
04-30 10:52PM 05.508

URL "/pic/quickview/FB7B82C8D4_PRu5nBT4" is dispatched to:
PicController#quickview

#
I 04-30 10:52PM 05.508

key of img:FB7B82C8D4_PRu5nBT4

#
I 04-30 10:52PM 05.533

png

#
E 04-30 10:52PM 05.536

Traceback (most recent call last):

#
E 04-30 10:52PM 05.536

  File "/base/python_dist/lib/python2.5/wsgiref/handlers.py", line 92,
in run

#
E 04-30 10:52PM 05.536

    self.result = application(self.environ, self.start_response)

#
E 04-30 10:52PM 05.536

  File "/base/python_lib/versions/1/google/appengine/ext/webapp/
__init__.py", line 521, in __call__

#
E 04-30 10:52PM 05.536

    response.wsgi_write(start_response)

#
E 04-30 10:52PM 05.536

  File "/base/python_lib/versions/1/google/appengine/ext/webapp/
__init__.py", line 241, in wsgi_write

#
E 04-30 10:52PM 05.536

    body = self.out.getvalue()

#
E 04-30 10:52PM 05.536

  File "/base/python_dist/lib/python2.5/StringIO.py", line 270, in
getvalue

#
E 04-30 10:52PM 05.536

    self.buf += ''.join(self.buflist)

#
E 04-30 10:52PM 05.536

UnicodeDecodeError: 'ascii' codec can't decode byte 0x89 in position
0: ordinal not in range(128)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to