Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Uncompressing Data(python) which is compressed using QT qUncompress function.
Forum Updated to NodeBB v4.3 + New Features

Uncompressing Data(python) which is compressed using QT qUncompress function.

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 933 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Uday More
    wrote on 1 Feb 2021, 05:31 last edited by
    #1

    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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 1 Feb 2021, 05:55 last edited by
      #2

      @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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3

      1/2

      1 Feb 2021, 05:31

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved