Kilbo
Kilbo

Reputation: 365

Python zlib.compress not accepting 3 arguments?

System: Windows

Trying to run zlib.compress(save_file_data, level=1, wbits=-zlib.MAX_WBITS) but I keep getting

return zlib.compress(save_file_data, level=1, wbits=-zlib.MAX_WBITS)
TypeError: compress() takes at most 2 arguments (3 given)

even though https://docs.python.org/3/library/zlib.html shows compress taking those arguments. I have tried reinstalling zlib and confirmed I'm running python3

Upvotes: 0

Views: 146

Answers (1)

Tzane
Tzane

Reputation: 3472

If you are using a python version older than 3.11, wbits argument is not available (so only 2 arguments). You can check your python version from the command line with python -V or in script with

>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=11, micro=5, releaselevel='final', serial=0)

https://docs.python.org/3.11/library/zlib.html#zlib.compress

Upvotes: 1

Related Questions