Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38747 > unrolled thread

Generate 16+MAX_WBITS decompressable data

Started byFayaz Yusuf Khan <fayaz@dexetra.com>
First post2013-02-12 18:17 +0530
Last post2013-02-12 18:17 +0530
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Generate 16+MAX_WBITS decompressable data Fayaz Yusuf Khan <fayaz@dexetra.com> - 2013-02-12 18:17 +0530

#38747 — Generate 16+MAX_WBITS decompressable data

FromFayaz Yusuf Khan <fayaz@dexetra.com>
Date2013-02-12 18:17 +0530
SubjectGenerate 16+MAX_WBITS decompressable data
Message-ID<mailman.1698.1360673397.2939.python-list@python.org>
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')
'x\x9c\xcbH\xcd\xc9\xc9\x07\x00\x06,\x02\x15'
>>> 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
+91-9746-830-823

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web