Niels Egberts <niels.egberts <at> gmail.com> writes: > zlib.error: Error -3 while decompressing data: incorrect header check > > How can I solve this?
The link you quoted says "you need to first base64 decode the string, then gunzip the resulting data" ... so gunzip it: | >>> s0 = "H4sIAAAAA......" | >>> import base64 | >>> s1 = base64.b64decode(s0) | >>> len(s0) | 72 | >>> len(s1) | 54 | >>> import StringIO # or cStringIO or io depending on what # Python versions you want to support | >>> sio = StringIO.StringIO(s1) | >>> import gzip | >>> gzf = gzip.GzipFile(fileobj=sio) | >>> guff = gzf.read() | >>> len(guff) | 4096 | >>> guff[:100] | '\x1b\x00\x00\x00\x1b\x00\x00\x00\x1b\x00\x00\x00 [snip] What a long journey: parse xml, base64 decode, gunzip, and you're still not home; next stop is struct.unpack ... HTH, John -- http://mail.python.org/mailman/listinfo/python-list