Message368449
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. |
|
Date |
User |
Action |
Args |
2020-05-08 15:47:01 | bustawin | set | recipients:
+ bustawin |
2020-05-08 15:47:01 | bustawin | set | messageid: <1588952821.29.0.991302590341.issue40564@roundup.psfhosted.org> |
2020-05-08 15:47:01 | bustawin | link | issue40564 messages |
2020-05-08 15:47:01 | bustawin | create | |
|