Closed ylsun136 closed 4 years ago
Could you provide an example file?
Uhh..this interface does not allow me to attach an empty file :(
I can reproduce the error on a new empty .docx file created from the right-click menu in File Explorer:
If it's an empty, zero-byte file, I'm not sure there's much Mammoth can do with that?
Fair, I'll add a catch for zero file size then..thanks :))
Conversion raises a
BadZipFile
error if the .docx file was created through context menu or 'New item' menu option in File Explorer, and has not been edited.Environment
Windows 10 python 3.8.3 (anaconda)
To reproduce
Create a new file
empty.docx
in File Explorer, using the right-click context menu->New->Microsoft Word Document, or the New item->Micorsoft Word Document option on the 'Home' ribbon.On the CLI, run
mammoth <path to file>\empty.docx
.Additional info
The same error is rasied in calls to both
mammoth.convert_to_html()
andmammoth.extract_raw_text()
.If the .docx was created new and saved without making edits in Microsoft Word, conversion works without error.
If the .docx has been edited in any way and saved, conversion works without error.
Traceback