scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.35k stars 510 forks source link

Powerpoint needs to "repair" and then cannot open a saved file #786

Closed iakov-aws closed 2 years ago

iakov-aws commented 2 years ago

Hi,

I just open a file and then save it to a new one. PowerPoint cannot read the created file even after repair. It works with other PPTx files but does not with this new one. Also the original opens perfectly in PowerPoint.

How can i check what is wrong with this file?

prs = Presentation(template)
prs.save('tmp.pptx')

python-pptx==0.6.21

iakov-aws commented 2 years ago

Interestingly i see the same error in 0.6.20, but 0.6.19 even cannot open the orginal file

Python.framework/Versions/3.9/lib/python3.9/zipfile.py in getinfo(self, name)
   1427         info = self.NameToInfo.get(name)
   1428         if info is None:
-> 1429             raise KeyError(
   1430                 'There is no item named %r in the archive' % name)

KeyError: "There is no item named 'ppt/NULL' in the archive"
iakov-aws commented 2 years ago

Finally, managed to copy all slides to a new presentation.