T0ha / ezodf

ezodf is a Python package to create new or open existing OpenDocument (ODF) files to extract, add, modify or delete document data, forked from dead project https://bitbucket.org/mozman/ezodf
Other
61 stars 23 forks source link

Add support for Flat XML OpenDocumentFormat files #22

Open jonadem opened 7 years ago

jonadem commented 7 years ago

When I try to open a .odt file, I get:

>>> textproc = ezodf.opendoc("foo.fodt")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/ezodf/document.py", line 54, in opendoc
    mime_type = __detect_mime_type(fm)
  File "/usr/local/lib/python2.7/dist-packages/ezodf/document.py", line 69, in __detect_mime_type
    mime_type = MIMETYPES[ext]
KeyError: '.fodt'

Same for .ods files

jonadem commented 7 years ago

I think commit c96fe52dad92d62e3bd9c32e6b64393ec1ea55f8 introduced the issue. Before it checks first if provided file is a zip; after it checks first if filename is not None (and don't reach the flat xml test).

jonadem commented 5 years ago

PR #23 solve the issue.