[英]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
一次将其送入一个字节,直到失败并出现错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.