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