I did a temporary hack... I edited encoder.py and changed s =
s.decode('utf8') to s = s.decode('utf-8','ignore') and it works.. but
Im not sure it will work on the google servers. . Any advice ? – yonny
18 mins ago


On Jun 3, 6:16 pm, uo <yon...@googlemail.com> wrote:
> Hello people,
>       I'm developing an app on GAE using Django and I run into a
> problem. I'm trying to return json to the front end and the serializer
> is trying to serialize binary content in the form of a PNG,
> consequently I get this error:
>
> Traceback: File "/media/disk/Projex/propertyPortal/prop/views/item.py"
> in json 42. return HttpResponse(simplejson.dumps({"items":[to_dict(i)
> for i in Item.all()]}), mimetype='application/json') File "/usr/lib/
> python2.6/json/init.py" in dumps 230. return
> _default_encoder.encode(obj) File "/usr/lib/python2.6/json/encoder.py"
> in encode 367. chunks = list(self.iterencode(o)) File "/usr/lib/
> python2.6/json/encoder.py" in _iterencode 309. for chunk in
> self._iterencode_dict(o, markers): File "/usr/lib/python2.6/json/
> encoder.py" in _iterencode_dict 275. for chunk in
> self._iterencode(value, markers): File "/usr/lib/python2.6/json/
> encoder.py" in _iterencode 306. for chunk in self._iterencode_list(o,
> markers): File "/usr/lib/python2.6/json/encoder.py" in
> _iterencode_list 204. for chunk in self._iterencode(value, markers):
> File "/usr/lib/python2.6/json/encoder.py" in _iterencode 309. for
> chunk in self._iterencode_dict(o, markers): File "/usr/lib/python2.6/
> json/encoder.py" in _iterencode_dict 275. for chunk in
> self._iterencode(value, markers): File "/usr/lib/python2.6/json/
> encoder.py" in _iterencode 294. yield encoder(o) File "/usr/lib/
> python2.6/json/encoder.py" in py_encode_basestring_ascii 63. s =
> s.decode('utf-8') File "/usr/lib/python2.6/encodings/utf_8.py" in
> decode 16. return codecs.utf_8_decode(input, errors, True)
>
> Exception Type: UnicodeDecodeError at /property/json/ Exception Value:
> 'utf8' codec can't decode byte 0x89 in position 0: unexpected code
> byte
>
> my model:
>
> class Item(db.Model): owner = db.UserProperty() title =
> db.StringProperty(multiline=True) price = db.StringProperty()
> primaryImage = db.BlobProperty()
>
> My question is how can I exclude the image from being serialized to
> json? Please help . Thanks

-- 
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-appeng...@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