Skip to content

ZipFile - That compression method is not supported #132223

New issue

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

Closed
alex-bork opened this issue Apr 7, 2025 · 4 comments
Closed

ZipFile - That compression method is not supported #132223

alex-bork opened this issue Apr 7, 2025 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@alex-bork
Copy link

alex-bork commented Apr 7, 2025

Bug report

Bug description:

Hi, when I try to read a zipfile that has compression = 0, I get everytime the error "That compression method is not supported". In the debugger, the compression is set to 99 instead of take the one from the file itself.

I have found the code block where it is set to 99. But first my coding:

            with zip.ZipFile(io.BytesIO(zip2load.read()), mode="r") as zipfile:
                files = zip.ZipFile.namelist(zipfile)
                append_files = []
                for file in files:
                    name, ext = os.path.splitext(file)
                    try:
                        file_bytes = zipfile.read(file, pwd=password if password else None)
                    except Exception as ex:

CPython versions tested on:

3.13

Operating systems tested on:

macOS

@alex-bork alex-bork added the type-bug An unexpected behavior, bug, or error label Apr 7, 2025
@alex-bork
Copy link
Author

Here is the code that changes the compression to 99:

Image

@picnixz picnixz added the stdlib Python modules in the Lib dir label Apr 7, 2025
@serhiy-storchaka
Copy link
Member

99 is AE-x encryption marker (see https://pkwaredownloads.blob.core.windows.net/pem/APPNOTE.txt).

The zipfile module only supports a subset of the ZIP file format. Use other tools to unpack that file.

@StanFromIreland
Copy link
Contributor

This issue can be closed, unless there's a plan to extend zipfile to support AE-x encryption (which is unlikely IMO).

@serhiy-storchaka
Copy link
Member

If someone provides code to support strong encryption in ZIP files, we can consider it. Until then, there is no point in leaving the issue open.

@serhiy-storchaka serhiy-storchaka closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

4 participants