Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useless error message if wrong file path is given #19

Open
ghost opened this issue Aug 4, 2016 · 1 comment
Open

Useless error message if wrong file path is given #19

ghost opened this issue Aug 4, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 4, 2016

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.

@franciscod
Copy link

Got bitten by this error. I had restructured some directories and didn't notice the path wasn't right. Thanks for filing this bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant