Lector
Lector copied to clipboard
Can't Open .epub Files
trafficstars
I run Kubuntu 19.10. Not only am I unable to open .pdf files as I can't install pymupdf (which isn't a big deal because I already have a good PDF reader), but most importantly, I can't open .epub files either.
Here's my log when I try opening one:
2020/09/08 15:41:07,896 lector.readers.read_epub WARNING toc.ncx not found in /home/aeonwaves/Downloads/~~~Reading~~~/eBooks - Selection/BOOK.epub
2020/09/08 15:41:07,900 lector.sorter ERROR Content generation error: /home/aeonwaves/Downloads/~~~Reading~~~/eBooks - Selection/BOOK.epub KeyError Arguments: ('ncx',)
Traceback (most recent call last):
File "/home/aeonwaves/Downloads/~~~Software~~~/Lector/Lector/lector/sorter.py", line 290, in read_book
book_breakdown = book_ref.generate_content()
File "/home/aeonwaves/Downloads/~~~Software~~~/Lector/Lector/lector/parsers/epub.py", line 46, in generate_content
self.book.generate_toc()
File "/home/aeonwaves/Downloads/~~~Software~~~/Lector/Lector/lector/readers/read_epub.py", line 151, in generate_toc
navpoints = toc_dict['ncx']['navMap']['navPoint']
KeyError: 'ncx'
2020/09/08 15:41:07,953 lector.main ERROR No parseable files found
BeautifulSoup cannot parse None so we need to handle the case
diff --git a/lector/readers/read_epub.py b/lector/readers/read_epub.py
index 124e8e5..55d9619 100644
--- a/lector/readers/read_epub.py
+++ b/lector/readers/read_epub.py
@@ -193,7 +193,7 @@ class EPUB:
self.split_chapters[chapter_file] = {}
chapter_content = self.get_chapter_content(chapter_file)
- soup = BeautifulSoup(chapter_content, 'lxml')
+ soup = BeautifulSoup(chapter_content or '', 'lxml')
split_anchors = i[1]
for this_anchor in reversed(split_anchors):