Message397590
I was able to replicate the error using the script as posted:
```
draft $ cat > issue44638.py
import zipfile
class TestClass:
def __init__(self, path):
self.zip_file = zipfile.ZipFile(path)
def iter_dir(self):
return [each.name for each in zipfile.Path(self.zip_file).iterdir()]
def read(self, filename):
with self.zip_file.open(filename) as file:
print(file.read())
root = "zipfile.zip"
test = TestClass(root)
files = test.iter_dir()
test.read(files[0])
draft $ python -m zipfile -c zipfile.zip issue44638.py
draft $ python issue44638.py
Traceback (most recent call last):
File "/Users/jaraco/draft/issue44638.py", line 18, in <module>
test.read(files[0])
File "/Users/jaraco/draft/issue44638.py", line 12, in read
with self.zip_file.open(filename) as file:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 1518, in open
fheader = zef_file.read(sizeFileHeader)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/zipfile.py", line 741, in read
self._file.seek(self._pos)
ValueError: seek of closed file
``` |
|
Date |
User |
Action |
Args |
2021-07-16 00:26:56 | jaraco | set | recipients:
+ jaraco, xtreak, jack__d, christian.steinmeyer |
2021-07-16 00:26:56 | jaraco | set | messageid: <1626395216.36.0.651483357723.issue44638@roundup.psfhosted.org> |
2021-07-16 00:26:56 | jaraco | link | issue44638 messages |
2021-07-16 00:26:56 | jaraco | create | |
|