GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — zipapp fails cryptically on large ZIP64-formatted archives because zipimport.py doesn't support ZIP64. · Issue #95706 · python/cpython Closed Labels stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportWhen using Zipapp (and other related projects) to create standalone Python applications my colleagues and I ran into trouble using any large but valid Turns out Minimal reproductionCreate a Zip64 archive file using a simple """ Use the `zipapp` module to write a Zip64 archive to disk. (Alternatively the `zipfile` module can be used directly.) """ import os import pathlib import tempfile import zipapp import zipfile def main() -> int: num_dummy_files = 10 dummy_file_size = int((1.5 * zipfile.ZIP64_LIMIT) // num_dummy_files) temp_dir = tempfile.TemporaryDirectory() for i in range(num_dummy_files): with open(pathlib.Path(temp_dir.name, f"{i}.bin"), "wb") as dummy_f: dummy_f.write(os.urandom(dummy_file_size)) with open(pathlib.Path(temp_dir.name, "__main__.py"), "w") as main_f: main_f.write("print('Hello from the zipapp __main__py!')") zipapp.create_archive(temp_dir.name, "zip64_sized.pyz") temp_dir.cleanup() return 0 if __name__ == "__main__": raise SystemExit(main()) Attempt to execute the large python3.11 zip64_sized.pyz /workspaces/cpython/python: can't find '__main__' module in '/workspaces/cpython/zip64_sized.pyz' # or, using interpreters compiled from latest `main` (698fa8bf) ./python zip64_size.pyz /usr/local/bin/python3.11: can't find '__main__' module in '/workspaces/cpython/zip64_sized.pyz' The How to fixThe The 'full' fix for this issue would be to refactor A first fix I think could be just providing a clearer error message when I'm happy to provide patches for each of these fixes in turn, if there's support for it. :) Edit: Began attempting to raise an exception on Zip64 archives, but it seems on raising an exception within Your environment- CPython versions tested on:
- Operating system and architecture: uname -a
Linux codespaces-5a1930 5.4.0-1086-azure #91~18.04.1-Ubuntu SMP Thu Jun 23 20:33:05 UTC 2022 x86_64 x86_64 x86_64 GNU/LinuxRelated: Activity
MetadataMetadataAssigneesLabelsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |