Код: Выделить всё
import json
import snappy
state_dict["html_page"] = unicode(snappy.compress(html_page),errors="ignore")
"""
If i miss this unicode function
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbc in position 0: unexpected code byte
"""
........
........
return json.dumps(state_dict)
Код: Выделить всё
d = json.loads(mydict)
snappy.uncompress(d['html_page'].encode("utf-8"))
In [122]: snappy.uncompress(d['html_page'].encode("utf-8"))
---------------------------------------------------------------------------
UncompressError Traceback (most recent call last)
/home/gridlex/workspace/MatrixInfrastructure/ in ()
UncompressError: An error ocurred while uncompressing the string
Подробнее здесь: https://stackoverflow.com/questions/145 ... -in-python
Мобильная версия