This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bustawin
Recipients bustawin
Date 2020-05-08.15:47:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588952821.29.0.991302590341.issue40564@roundup.psfhosted.org>
In-reply-to
Content
Given a .zip file with more than one inner file, when reading those inner files using zipfile.Path the zip module closes the .zip file prematurely, causing an error.

Given the following code (example zipfile is attached, but any should work).

with zipfile.ZipFile('foo.zip') as file:
    for name in ['file-1.txt', 'file-2.txt']:
        p = zipfile.Path(file, name)
        with p.open() as inner:
            print(list(inner)) # ValueError: seek of closed file

But the following code does not fail:

with zipfile.ZipFile('foo.zip') as file:
    for name in ['file-1.txt', 'file-2.txt']:
        with file.open(name) as inner:
            print(list(inner)) # Works!


Python 3.8.2 macOS 10.15.4.
History
Date User Action Args
2020-05-08 15:47:01bustawinsetrecipients: + bustawin
2020-05-08 15:47:01bustawinsetmessageid: <1588952821.29.0.991302590341.issue40564@roundup.psfhosted.org>
2020-05-08 15:47:01bustawinlinkissue40564 messages
2020-05-08 15:47:01bustawincreate