We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32_GENERIC_C3-20250415-v1.25.0
MicroPython v1.25.0 on 2025-04-15; ESP32C3 module with ESP32C3
with open('response_body.bin', 'rb') as f: data = f.read() len(data)
1794
import deflate, io with deflate.DeflateIO(io.BytesIO(data), deflate.ZLIB) as d: decompressed_data = d.read()
Traceback (most recent call last): File "", line 2, in OSError: [Errno 22] EINVAL
with open('response_body.bin', 'rb') as f: with deflate.DeflateIO(f, deflate.GZIP) as d: decompressed_data = d.read()
(Decompressing directly from a file stream works!)
data[:40]
b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\xcd[\xdbn\xdbF\x10}\xcfW\x082\xfa\x12\xc4\xb2HK\x96\xec\x17c\x11\xb1\xf5\x9aWh\x97L'
Expected to work without the EINVAL exception
Using deflate.DeflateIO with a stream from io.BytesIO throws exception EINVAL
Here is what the Linux file command says about the data to be decompressed:
$ file response_body.bin response_body.bin: gzip compressed data, from Unix, original size modulo 2^32 15437
Yes, I agree
The text was updated successfully, but these errors were encountered:
According to an example from https://docs.micropython.org/en/latest/library/deflate.html deflate.DeflateIO(io.BytesIO(compressed_data), deflate.ZLIB) should work
Sorry, something went wrong.
No branches or pull requests
Port, board and/or hardware
ESP32_GENERIC_C3-20250415-v1.25.0
MicroPython version
MicroPython v1.25.0 on 2025-04-15; ESP32C3 module with ESP32C3
Reproduction
1794
Traceback (most recent call last):
File "", line 2, in
OSError: [Errno 22] EINVAL
(Decompressing directly from a file stream works!)
b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\xcd[\xdbn\xdbF\x10}\xcfW\x082\xfa\x12\xc4\xb2HK\x96\xec\x17c\x11\xb1\xf5\x9aWh\x97L'
Expected behaviour
Expected to work without the EINVAL exception
Observed behaviour
Using deflate.DeflateIO with a stream from io.BytesIO throws exception EINVAL
Additional Information
Here is what the Linux file command says about the data to be decompressed:
$ file response_body.bin
response_body.bin: gzip compressed data, from Unix, original size modulo 2^32 15437
Code of Conduct
Yes, I agree
The text was updated successfully, but these errors were encountered: