Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'chunk': 0.07; 'data:': 0.07; 'exception:': 0.09; 'here?': 0.09; 'incorrect': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:f 30': 0.15; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:z 30': 0.16; 'subject:Generate': 0.16; 'zlib': 0.16; '>>>': 0.18; 'code.': 0.20; 'cloud': 0.20; 'trying': 0.21; 'import': 0.21; '"",': 0.22; "skip:' 40": 0.22; "i've": 0.23; 'second': 0.24; 'header': 0.24; 'header:User-Agent:1': 0.26; '(most': 0.27; 'subject:skip:d 10': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'piece': 0.29; "i'm": 0.29; "skip:' 10": 0.30; 'error': 0.30; 'code': 0.31; 'file': 0.32; 'getting': 0.33; 'subject:data': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'skip:d 20': 0.34; "can't": 0.34; 'project': 0.34; 'ahead': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'india': 0.36; 'skip:z 10': 0.37; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'remove': 0.61; 'received:106': 0.65; 'yusuf': 0.84; 'subject:+': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Fayaz Yusuf Khan Subject: Generate 16+MAX_WBITS decompressable data Followup-To: gmane.comp.python.general Date: Tue, 12 Feb 2013 18:17:20 +0530 Organization: Dexetra Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: 106.51.143.58 User-Agent: KNode/4.4.11 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360673397 news.xs4all.nl 6903 [2001:888:2000:d::a6]:45091 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38747 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 "", line 1, in 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