wustho / epy

CLI Ebook (epub2, epub3, fb2, mobi) Reader
GNU General Public License v3.0
962 stars 52 forks source link

crash in the wrapper function #48

Closed mcepl closed 2 years ago

mcepl commented 2 years ago
fanfiction@stitny$ epy elsewhere_at_hogwarts/Thursdays.epub
Traceback (most recent call last):
  File "/home/matej/.local/bin/epy", line 33, in <module>
    sys.exit(load_entry_point('epy-reader', 'console_scripts', 'epy')())
  File "/home/matej/archiv/knihovna/repos/tmp/epy/epy.py", line 3469, in main
    curses.wrapper(preread, filepath)
  File "/usr/lib64/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/matej/archiv/knihovna/repos/tmp/epy/epy.py", line 3326, in preread
    reading_state = reader.read(reading_state)
  File "/home/matej/archiv/knihovna/repos/tmp/epy/epy.py", line 2905, in read
    rettock, fllwd, _ = self.toc(toc_entries, ntoc)
  File "/home/matej/archiv/knihovna/repos/tmp/epy/epy.py", line 1740, in wrapper
    strs = "  " + i.replace("\n", " ")
AttributeError: 'NoneType' object has no attribute 'replace'
fanfiction@stitny$
wustho commented 2 years ago

Hey there, thanks for detailed traceback. If you don't mind, can I know where I can download that epub?

Seems like anomaly from the epub structure. I think the fix should be simple. But I also think it's better for the fix to be specific to how fundamental the anomaly is ...

mcepl commented 2 years ago

Hey there, thanks for detailed traceback. If you don't mind, can I know where I can download that epub?

https://mcepl.fedorapeople.org/tmp/Thursdays.epub

I am not sure, where I’ve got this … ah, I see https://hayseed42.wordpress.com/2014/06/27/getting-the-hang-of-thursdays-0122/ … that could be some pretty bad conversion via pandoc or something of that kind. So, yes, epy shouldn't crash on any EPub, but don't sweat over this too much.

wustho commented 2 years ago

@mcepl Hey there, just fixed it with this: https://github.com/wustho/epy/commit/282270a51d9d52689f6362f17b760d6cb1d3dac6 Thanks for traceback...

Edit: Ah I forgot that I also change the schema which won't be backward compatible (https://github.com/wustho/epy#changelog) so you might lose your reading progress if updating to git version. I haven't update the PyPi, waiting to be a little bit more stable...

mcepl commented 2 years ago

Thank you, I will test. It seems to work so far.

mcepl commented 2 years ago

Hmm, it somehow went away.