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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -