[issue34202] 3.6 ZipFile fails with Path

Berker Peksag report at bugs.python.org
Mon Jul 23 23:14:35 EDT 2018


Berker Peksag <berker.peksag at gmail.com> added the comment:

Thanks for the report! Support for path-like objects was added in 3.6.2. I think you either have 3.6.0 or 3.6.1 installed on your system. Please upgrade it to the latest bugfix release.

With 3.6.6, I got the following results:

>>> import zipfile
>>> from pathlib import Path
>>> path = Path('spam.zip')
>>> zf = zipfile.ZipFile(path, 'w')
>>> zf.writestr('test.txt', 'Hello, Sailor!')
>>> zf.close()

$ ./python -m zipfile -l spam.zip 
File Name                                             Modified             Size
test.txt                                       2018-07-24 06:10:52           14

----------
nosy: +berker.peksag
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34202>
_______________________________________


More information about the Python-bugs-list mailing list