From da4daa6a8add27351a33ebb12fcd58e7fe45be70 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Sun, 12 Dec 2021 18:46:28 -0800 Subject: [PATCH] Fix rarfile import as by default it is optional --- comicapi/comicarchive.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/comicapi/comicarchive.py b/comicapi/comicarchive.py index d5a39c5..02ee666 100644 --- a/comicapi/comicarchive.py +++ b/comicapi/comicarchive.py @@ -26,7 +26,11 @@ import io import natsort from PyPDF2 import PdfFileReader -from unrar.cffi import rarfile +try: + from unrar.cffi import rarfile +except: + pass + try: import Image pil_available = True @@ -627,7 +631,10 @@ class ComicArchive: return zipfile.is_zipfile(self.path) def rarTest(self): - return rarfile.is_rarfile(self.path) + try: + return rarfile.is_rarfile(self.path) + except: + return False def isZip(self): return self.archive_type == self.ArchiveType.Zip