Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Generate 16+MAX_WBITS decompressable data (

Fayaz Yusuf Khan 02-12-2013 12:47 PM

Generate 16+MAX_WBITS decompressable data
I'm trying write unit-tests for some of my old code and have run into this
piece of code.

dcomp = zlib.decompressobj(16+zlib.MAX_WBITS)
chunk = ''.join(f.chunks())
received_data = dcomp.decompress(chunk)

How do I generate the chunk here? From what I've been trying I'm getting
this exception:
>>> import zlib
>>> zlib.compress('hello')

>>> zlib.decompress(_, 16+zlib.MAX_WBITS)

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
zlib.error: Error -3 while decompressing data: incorrect header check

zlib.decompress without the second argument works, but I can't really go
ahead into my project file and remove it.
Fayaz Yusuf Khan
Cloud architect, Dexetra SS, India
fayaz.yusuf.khan_AT_gmail_DOT_com, fayaz_AT_dexetra_DOT_com

All times are GMT. The time now is 02:42 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.