[issue43326] About Zipfile
Fcant
report at bugs.python.org
Fri Feb 26 04:21:11 EST 2021
Fcant <fcscanf at outlook.com> added the comment:
Because these special symbols are not handled under the Window, he will report an error and will not work properly
From:樊乘乘
Email:fcscanf at outlook.com<mailto:fcscanf at outlook.com>
Tel:17826260016
发件人: Ronald Oussoren<mailto:report at bugs.python.org>
发送时间: 2021年2月26日 樊乘 17:15
收件人: fcscanf at outlook.com<mailto:fcscanf at outlook.com>
主题: [issue43326] About Zipfile
Ronald Oussoren <ronaldoussoren at mac.com> added the comment:
I'm not sure what you are asking here.
Looking at the screenshot I'd say that the zipfile you are trying to extract contains files with a newline in their name. That's a perfectly valid (although annoying) name on unix-y platforms.
The zipfile module does not have an API for rewriting the file name when extracting. It is far from clear to me that adding such a API would be generally useful.
Emulating this is fairly easy though, something like:
zf = zipfile.ZipFile(...)
for name in zf.namelist():
stream = zf.open(name)
data = stream.read()
stream.close()
with open(name.replace(...), "w") as stream:
stream.write(data)
----------
nosy: +ronaldoussoren
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43326>
_______________________________________
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43326>
_______________________________________
More information about the Python-bugs-list
mailing list