Python 3.4: zlib, deflate and shared dict -
any ideas how fix following code (python 3.4.3):
import zlib hello = b'hello' co = zlib.compressobj(wbits=-zlib.max_wbits, zdict=hello) data = co.compress(hello) + co.flush() = zlib.decompressobj(wbits=-zlib.max_wbits, zdict=hello) data = do.decompress(data) print(data)
fails me with
zlib.error: error -3 while decompressing data: invalid distance far
what trying decompress deflate compressed shared dictionary.
you can't use negative wbits dictionary. negative wbits gets rid of zlib header , trailer, zlib header how decompress knows use dictionary.
just rid of wbits options.
Comments
Post a Comment