aerkalov/ebooklib

write_epub swallows IOError

BenjaminHamon opened this issue · 1 comments

The write_epub function, which is visibly the main function to create a EPUB file and which is used in the main example for the package, swallows IOError.

ebooklib/ebooklib/epub.py

Lines 1745 to 1748 in d4febc0

try:
epub.write()
except IOError:
pass

This seems dangerous, or at the very least strange, since the caller for such a function would expect to be notified of such an error, and generally swallowing exceptions is a bad practice. Right now the function fails silently.

Very good point. This is just wrong. When it comes to exceptions probably the whole system when it comes to read/write should be overlooked and more custom exceptions should be introduced.