Also log plugin opening failures.

This allows obtaining tracebacks of failures by plugins to open files by
setting the log-level to DEBUG, rather than by having to uncomment the
"traceback.print_exc" lines in Image.open.
This commit is contained in:
Antony Lee 2015-06-16 14:44:10 -07:00
parent 4e754e9c55
commit 983c4602b5

View File

@ -2300,9 +2300,7 @@ def open(fp, mode="r"):
_decompression_bomb_check(im.size) _decompression_bomb_check(im.size)
return im return im
except (SyntaxError, IndexError, TypeError, struct.error): except (SyntaxError, IndexError, TypeError, struct.error):
# import traceback logger.debug("", exc_info=True)
# traceback.print_exc()
pass
if init(): if init():
@ -2315,9 +2313,7 @@ def open(fp, mode="r"):
_decompression_bomb_check(im.size) _decompression_bomb_check(im.size)
return im return im
except (SyntaxError, IndexError, TypeError, struct.error): except (SyntaxError, IndexError, TypeError, struct.error):
# import traceback logger.debug("", exc_info=True)
# traceback.print_exc()
pass
raise IOError("cannot identify image file %r" raise IOError("cannot identify image file %r"
% (filename if filename else fp)) % (filename if filename else fp))