ezodf
ezodf copied to clipboard
Useless error message if wrong file path is given
If one calls opendoc()
with a non-existing path:
opened = ezodf.opendoc("/home/user/path/that/does/not/exist.ods")
This is what one gets:
Traceback (most recent call last):
File "/home/yyyyyyy/loop_list_test.py", line 9, in <module>
adapted_ods = ezodf.opendoc(adapted)
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: '.ods'
It's just a suggestion but a simple check if that file actually exists and a more meaningful error message would be very helpful here.
Got bitten by this error. I had restructured some directories and didn't notice the path wasn't right. Thanks for filing this bug!