Solved Uncompressing Data(python) which is compressed using QT qUncompress function.
-
I am compressing the data using the
inline QByteArray qCompress(const QByteArray& data, int compressionLevel = -1) function. I am able to compress the data and store it in the file. This compression is done using zlib default compression as mentioned in the documentation.I am trying to decompress the data using python zlib API (decompress function), but I get the following error.
"zlib.error: Error -3 while decompressing data: incorrect header check"Useful link : https://stackoverflow.com/questions/27440275/zlibdecompressor-throws-incorrect-header-check-exception
Can anyone please help how to proceed.
Qt 5.14.2
python 3.5.4 -
@Uday-More said in Uncompressing Data(python) which is compressed using QT qUncompress function.:
Can anyone please help how to proceed.
See the documentation: "Note: If you want to use this function to uncompress external data that was compressed using zlib, you first need to prepend a four byte header to the byte array containing the data. The header must contain the expected length (in bytes) of the uncompressed data, expressed as an unsigned, big-endian, 32-bit integer."
Since you want to uncompress it externally you have to remove the first 4 bytes.