zlib.decompress cannot, gunzip can

enrio at online.no enrio at online.no
Mon Feb 28 19:53:16 EST 2005


I have a string which I try to decompress:

  body = zlib.decompress(body)

but I get

  zlib.error: Error -3 while decompressing data: incorrect header check

However, I can write the string to a file and run gunzip with the
expected results:

  f = open('/tmp/bd.gz', 'w')
  f.write(body)
  f.close
...
  $ gunzip bd.gz
  $ less bd

What should I do to decompress it in Python?

Regards, Enrique




More information about the Python-list mailing list