简体   繁体   中英

Decide what byte causes the zlib inflate decompression operation

I got the following code which suppose to decompress a simple inflated data.

import zlib
print zlib.decompress(content)

It crashes with the following error

zlib.error: Error -3 while decompressing data: invalid distance too far back

I want to be able to log the index of the exact byte (the first one) that causes the decompression to fail... Is that possible?

使用decompressobj一个decompressor对象,并使用decompress一次将其送入一个字节,直到失败并出现错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM