ValueError: ZIP does not support timestamps before 1980
kasgel opened this issue · comments
kasgel commented
Currently when I try to use python-pptx
on Python 3.9 to save a new .pptx file, I get the following error:
Traceback (most recent call last):
File "test.py", line 19, in main
prs.save('test.pptx')
File "/packages/pptx/presentation.py", line 39, in save
self.part.save(file)
File "/packages/pptx/parts/presentation.py", line 107, in save
self.package.save(path_or_stream)
File "/packages/pptx/opc/package.py", line 153, in save
PackageWriter.write(pkg_file, self._rels, tuple(self.iter_parts()))
File "/packages/pptx/opc/serialized.py", line 76, in write
cls(pkg_file, pkg_rels, parts)._write()
File "/packages/pptx/opc/serialized.py", line 81, in _write
self._write_content_types_stream(phys_writer)
File "/packages/pptx/opc/serialized.py", line 91, in _write_content_types_stream
phys_writer.write(
File "/packages/pptx/opc/serialized.py", line 220, in write
self._zipf.writestr(pack_uri.membername, blob)
File "/usr/local/lib/python3.9/zipfile.py", line 1783, in writestr
zinfo = ZipInfo(filename=zinfo_or_arcname,
File "/usr/local/lib/python3.9/zipfile.py", line 361, in __init__
raise ValueError('ZIP does not support timestamps before 1980')
ValueError: ZIP does not support timestamps before 1980
This seems to be related to following: pypa/pip#9910
I believe the solution is to update python-pptx
to create a new zipfile.ZipFile with strict_timestamps=False
Steve Canny commented
Please post code that reproduces this error for you. Also state your exact Python version.