zlib compressionobj use: what am I missing?
Titus Brown
t at chabry.caltech.edu
Thu Aug 16 17:08:38 EDT 2001
Hi all, I'm working on a patch to the zlibmodule, but I can't get this
bit of code for testing compression objects to work at all. Should it?
If not, what am I doing wrong??
Help! ;)
---
import zlib
file = open('to-compress')
compobj = zlib.compressobj(1)
compdata = ''
while 1:
data = file.read(1000)
if data:
compdata += compobj.compress(data)
else:
break
compdata += compobj.flush()
zlib.decompress(compdata)
-
thanks,
--titus
ps note that this is being run against Python 2.2 from CVS, but the zlibmodule
hasn't changed for a while, so 2.1 users should have the same version I'm
using.
More information about the Python-list
mailing list