diff --git a/src/calibre/ebooks/comic/input.py b/src/calibre/ebooks/comic/input.py index f0acfe3a06..85590a7bae 100755 --- a/src/calibre/ebooks/comic/input.py +++ b/src/calibre/ebooks/comic/input.py @@ -8,6 +8,7 @@ Based on ideas from comiclrf created by FangornUK. ''' import os, shutil, traceback, textwrap, time +from ctypes import byref from Queue import Empty from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation @@ -75,7 +76,10 @@ class PageProcessor(list): if img < 0: raise RuntimeError('Cannot create wand.') if not pw.MagickReadImage(img, self.path_to_page): - raise IOError('Failed to read image from: %'%self.path_to_page) + severity = pw.ExceptionType(0) + msg = pw.MagickGetException(img, byref(severity)) + raise IOError('Failed to read image from: %s: %s' + %(self.path_to_page, msg)) width = pw.MagickGetImageWidth(img) height = pw.MagickGetImageHeight(img) if self.num == 0: # First image so create a thumbnail from it @@ -363,14 +367,14 @@ class ComicInput(InputFormatPlugin): else: new_pages, failures = process_pages(new_pages, self.opts, self.report_progress, tdir2) - if not new_pages: - raise ValueError('Could not find any valid pages in comic: %s' - % comic) if failures: self.log.warning('Could not process the following pages ' '(run with --verbose to see why):') for f in failures: self.log.warning('\t', f) + if not new_pages: + raise ValueError('Could not find any valid pages in comic: %s' + % comic) thumbnail = os.path.join(tdir2, 'thumbnail.'+self.opts.output_format.lower()) if not os.access(thumbnail, os.R_OK): diff --git a/src/calibre/utils/PythonMagickWand.py b/src/calibre/utils/PythonMagickWand.py index 16ca8d2935..9920334b0a 100644 --- a/src/calibre/utils/PythonMagickWand.py +++ b/src/calibre/utils/PythonMagickWand.py @@ -828,7 +828,7 @@ else: IsMagickWand = _magick.IsMagickWand # MagickGetException try: - _magick.MagickGetException.restype = ctypes.POINTER(ctypes.c_char) + _magick.MagickGetException.restype = ctypes.c_char_p _magick.MagickGetException.argtypes = (MagickWand,ctypes.POINTER(ExceptionType)) except AttributeError,e: pass