Skip to content

Commit

Permalink
Check for textile installation
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryPetukhovAkvelon committed Jul 6, 2019
1 parent 5e74b6f commit d0cdd53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -33,6 +33,7 @@ Bitcoin: 17jaxj26vFJNqQ2hEVerbBV5fpTusfqFro
| python-pymupdf | 1.14.5 | PDF support |
| python-djvulibre | 0.8.4 | DjVu support |
| python-markdown | 3.0.1 | Markdown support |
| textile | 3.0.4 | TXT support |

## Support
When reporting issues:
Expand Down
13 changes: 9 additions & 4 deletions lector/sorter.py
Expand Up @@ -105,10 +105,15 @@
print(critical_sting)
logger.critical(critical_sting)

# Text file parser
# TODO Check if textile is installed
from lector.parsers.txt import ParseTXT
sorter['txt'] = ParseTXT
# txt - Optional
textile_check = importlib.util.find_spec('textile')
if textile_check:
from lector.parsers.txt import ParseTXT
sorter['txt'] = ParseTXT
else:
error_string = 'textile is not installed. Will be unable to load TXT files.'
print(error_string)
logger.error(error_string)

available_parsers = [i for i in sorter]
progressbar = None # This is populated by __main__
Expand Down

0 comments on commit d0cdd53

Please sign in to comment.