wustho / epy

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

ImportError: cannot import name 'unpackBook' from 'epy_extras' (unknown location) #71

Closed 3N4N closed 1 year ago

3N4N commented 1 year ago
$ cat ~/.local/bin/epy
#!/bin/env bash

python3 ~/projects/tools/epy/epy.py $*

$ epy ~/Documents/ebooks/Standalone/The_Fisherman.epub
Traceback (most recent call last):
  File "/home/enan/projects/tools/epy/epy.py", line 71, in <module>
    from epy_extras import unpackBook  # type: ignore
ImportError: cannot import name 'unpackBook' from 'epy_extras' (unknown location)

The culprit line is: https://github.com/wustho/epy/blob/f6965def67103ccd398b198471548fd96c401147/epy.py#L74-L75

I think it should work with ModuleNotFoundError, but for some reason the error that I am getting is ImportError.

As of now I'm simply adding ImportError to the except block:

except (ImportError, ModuleNotFoundError):
    MOBI_SUPPORT = False
3N4N commented 1 year ago

For some reason, the folder epy_extras/ existed in my repository even though it wasn't in git ls-files nor in .gitignore. That folder existing is the reason for the error I was facing.

rm -rf epy_extras fixes it.

Feel free to close this. (But I am curious why this folder was left in the local repo when I pulled master branch.)