diff --git a/kcc.py b/kcc.py index 8362f73..23557ac 100644 --- a/kcc.py +++ b/kcc.py @@ -26,7 +26,7 @@ __docformat__ = 'restructuredtext en' import sys import os try: - # noinspection PyUnresolvedReferences + #noinspection PyUnresolvedReferences from PyQt4 import QtCore, QtGui, QtNetwork except ImportError: print "ERROR: PyQT4 is not installed!" diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 0843771..86f89da 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -77,11 +77,12 @@ class HTMLStripper(HTMLParser): return ''.join(self.fed) -#noinspection PyAttributeOutsideInit,PyShadowingBuiltins class WebServerHandler(BaseHTTPRequestHandler): + #noinspection PyShadowingBuiltins def log_message(self, format, *args): pass + #noinspection PyAttributeOutsideInit def do_GET(self): if self.path == '/': self.path = '/index.html' @@ -145,7 +146,6 @@ class WebServerHandler(BaseHTTPRequestHandler): self.send_error(404, 'File Not Found: %s' % self.path) -#noinspection PyBroadException class WebServerThread(QtCore.QThread): def __init__(self): QtCore.QThread.__init__(self) @@ -159,7 +159,7 @@ class WebServerThread(QtCore.QThread): try: # Sweet cross-platform one-liner to get LAN ip address lIP = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1][0] - except: + except StandardError: # Sadly it can fail on some Linux configurations lIP = None try: @@ -172,14 +172,13 @@ class WebServerThread(QtCore.QThread): self.emit(QtCore.SIGNAL("addMessage"), 'Content server started on port 4242.', 'info') while self.running: self.server.handle_request() - except: + except StandardError: self.emit(QtCore.SIGNAL("addMessage"), 'Content server failed to start!', 'error') def stop(self): self.running = False -# noinspection PyBroadException class VersionThread(QtCore.QThread): def __init__(self): QtCore.QThread.__init__(self) @@ -191,7 +190,7 @@ class VersionThread(QtCore.QThread): try: XML = urllib2.urlopen('http://kcc.vulturis.eu/Version.php') XML = parse(XML) - except Exception: + except StandardError: return latestVersion = XML.childNodes[0].getElementsByTagName('latest')[0].childNodes[0].toxml() if tuple(map(int, (latestVersion.split(".")))) > tuple(map(int, (__version__.split(".")))): diff --git a/kcc/cbxarchive.py b/kcc/cbxarchive.py index 5d0e36f..f70cabd 100644 --- a/kcc/cbxarchive.py +++ b/kcc/cbxarchive.py @@ -26,7 +26,6 @@ import locale from subprocess import Popen, STDOUT, PIPE -# noinspection PyBroadException class CBxArchive: def __init__(self, origFileName): self.origFileName = origFileName @@ -51,7 +50,7 @@ class CBxArchive: elif f.endswith('/'): try: os.makedirs(os.path.join(targetdir, f)) - except: + except StandardError: pass # the dir exists so we are going to extract the images only. else: filelist.append(f) @@ -66,7 +65,7 @@ class CBxArchive: elif f.endswith('/'): try: os.makedirs(os.path.join(targetdir, f)) - except: + except StandardError: pass # the dir exists so we are going to extract the images only. else: filelist.append(f.encode(locale.getpreferredencoding())) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index a23103d..87d6c21 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -347,7 +347,6 @@ def fileImgProcess_tick(output): def fileImgProcess(work): - #noinspection PyBroadException try: afile = work[0] dirpath = work[1] @@ -391,7 +390,7 @@ def fileImgProcess(work): img2.rotated = True applyImgOptimization(img2, opt, 0) img2.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True) - except: + except StandardError: return str(sys.exc_info()[1]) @@ -710,7 +709,7 @@ def splitDirectory(path, mode): return output -# noinspection PyUnboundLocalVariable +#noinspection PyUnboundLocalVariable def preSplitDirectory(path): if getDirectorySize(os.path.join(path, 'OEBPS', 'Images')) > 262144000: # Detect directory stucture diff --git a/kcc/comic2panel.py b/kcc/comic2panel.py index fa2a66f..9354fad 100644 --- a/kcc/comic2panel.py +++ b/kcc/comic2panel.py @@ -29,7 +29,7 @@ from shutil import rmtree, copytree, move from optparse import OptionParser, OptionGroup from multiprocessing import Pool, freeze_support try: - # noinspection PyUnresolvedReferences + #noinspection PyUnresolvedReferences from PIL import Image, ImageStat if tuple(map(int, ('2.2.1'.split(".")))) > tuple(map(int, (Image.PILLOW_VERSION.split(".")))): print "ERROR: Pillow 2.2.1 or newer is required!" @@ -93,8 +93,8 @@ def splitImage_tick(output): splitWorkerPool.terminate() +#noinspection PyUnboundLocalVariable def splitImage(work): - #noinspection PyBroadException try: path = work[0] name = work[1] @@ -156,7 +156,6 @@ def splitImage(work): for panel in panelsCleaned: panels.append(panel) if opt.debug: - # noinspection PyUnboundLocalVariable debugImage.save(os.path.join(path, fileExpanded[0] + '-debug.png'), 'PNG') # Create virtual pages @@ -195,7 +194,7 @@ def splitImage(work): str(pageNumber) + '.png'), 'PNG') pageNumber += 1 os.remove(filePath) - except: + except StandardError: return str(sys.exc_info()[1]) @@ -204,7 +203,6 @@ def Copyright(): 'Written 2013 by Ciro Mattia Gonano and Pawel Jastrzebski.' % globals()) -# noinspection PyBroadException def main(argv=None, qtGUI=None): global options, GUI, splitWorkerPool, splitWorkerOutput parser = OptionParser(usage="Usage: %prog [options] comic_folder", add_help_option=False)