Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Generate 16+MAX_WBITS decompressable data

Reply
Thread Tools

Generate 16+MAX_WBITS decompressable data

 
 
Fayaz Yusuf Khan
Guest
Posts: n/a
 
      02-12-2013
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Generate 16+MAX_WBITS decompressable data Terry Reedy Python 2 02-13-2013 06:30 AM
Failed to generate a user instance of SQL Server. Only an integratedconnection can generate a user instance. Harlan Messinger ASP .Net 2 03-28-2010 06:51 PM
How to generate warnings when How generate a warning when int is converted to bool or vice versa? PengYu.UT@gmail.com C++ 3 04-06-2006 11:24 PM
How to generate variable labels for same component within a generate loop Weng Tianxiang VHDL 5 02-16-2006 01:45 PM
How to generate serial random data pattern ? C T VHDL 3 03-05-2004 12:35 PM



Advertisments