diff --git a/comicvinetalker.py b/comicvinetalker.py index 770c16a..8d61a4b 100644 --- a/comicvinetalker.py +++ b/comicvinetalker.py @@ -25,8 +25,11 @@ import urllib2, urllib import math import re -from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest -from PyQt4.QtCore import QUrl, pyqtSignal, QObject, QByteArray +try: + from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest + from PyQt4.QtCore import QUrl, pyqtSignal, QObject, QByteArray +except ImportError: + pass import utils from settings import ComicTaggerSettings diff --git a/imagehasher.py b/imagehasher.py index 15e2e41..28cc9c9 100755 --- a/imagehasher.py +++ b/imagehasher.py @@ -1,7 +1,14 @@ -import Image import StringIO +try: + import Image + pil_available = True +except ImportError: + pil_available = False + + + class ImageHasher(object): def __init__(self, path=None, data=None, width=8, height=8): #self.hash_size = size diff --git a/issueidentifier.py b/issueidentifier.py index ee8b643..71d3740 100644 --- a/issueidentifier.py +++ b/issueidentifier.py @@ -22,7 +22,11 @@ import sys import math import urllib2, urllib import StringIO -import Image +try: + import Image + pil_available = True +except ImportError: + pil_available = False from settings import ComicTaggerSettings from comicvinecacher import ComicVineCacher @@ -203,10 +207,15 @@ class IssueIdentifier: ca = self.comic_archive self.match_list = [] self.cancel = False - + self.search_result = self.ResultNoMatches + + if not pil_available: + print "Python Imaging Library (PIL) is not available and is needed for issue identification." + return self.match_list + if not ca.seemsToBeAComicArchive(): self.log_msg( "Sorry, but "+ opts.filename + " is not a comic archive!") - return self.ResultNoMatches, [] + return self.match_list cover_image_data = ca.getCoverPage() cover_hash = self.calculateHash( cover_image_data )