wustho / epy

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

AttributeError for PROC_COUNTLETTERS.kill() in version 2020.4.24 #8

Closed ratnamhof closed 3 years ago

ratnamhof commented 4 years ago

Hi Wustho,

Nice that you have added the bookmark functionality! Neat feature! Also good to see that you are actively developing epy [and not only epr ;)] and willing to share your work!

For a possible future version I would suggest to adjust lines 660&661:

# PROC_COUNTLETTERS.terminate()
PROC_COUNTLETTERS.kill()

into

try:
    PROC_COUNTLETTERS.kill()
except AttributeError:
    PROC_COUNTLETTERS.terminate()

On my setup the first leads to attribute errors (perhaps there are some different versions of multiprocessing python package floating around?; I am using python 3.6.9 on ubuntu 18.04 b.t.w.). As far as I could judge the errors occur when the terminal area resizes. With the try-catch epy works again for me also when resizing the terminal. One could also instead use if hasattr(PROC_COUNTLETTERS,'kill') to get to a "get permission" methodology instead of the "ask forgiveness, not permission" philosophy of try-catch ...

Please feel free to ignore if you disagree ;)

Thanks again and with kind regards, happy user

wustho commented 4 years ago

Hey there thanks.

Ah that try-except will do, indeed I had problem with terminate() and kill() methods... But it never came to mind to use try-except block at that moment, so I comment out one of those. Thanks for input, I will fixed it with try except later...