New submission from Xavier <[email protected]>:
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.
----------
components: IO
files: zipfile.zip
messages: 368449
nosy: bustawin
priority: normal
severity: normal
status: open
title: Using zipfile.Path with several files prematurely closes zip
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49142/zipfile.zip
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40564>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com