On Sat, 21 Jul 2007 19:13:22 -0700, Andrey wrote: > My question is, anyone will suggest a workaround to this error? > i really like to pack my raw image data into the JSON, so my other > programming script can read the array easily
JSON is a text format so you have to encode the binary data somehow. I'd use base64. It's available as codec for `str.encode()`/`str.decode()`. In [10]: '\x00\xff\xaa' Out[10]: '\x00\xff\xaa' In [11]: '\x00\xff\xaa'.encode('base64') Out[11]: 'AP+q\n' In [12]: _.decode('base64') Out[12]: '\x00\xff\xaa' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list