mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #566 from larsmans/error-messages
more detailed error messages from Image.py
This commit is contained in:
commit
2febf7cfa3
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,3 +5,6 @@ dist
|
||||||
.tox
|
.tox
|
||||||
*.so
|
*.so
|
||||||
docs/_build
|
docs/_build
|
||||||
|
|
||||||
|
# Vim cruft
|
||||||
|
.*.swp
|
||||||
|
|
|
@ -1965,7 +1965,7 @@ def fromarray(obj, mode=None):
|
||||||
else:
|
else:
|
||||||
ndmax = 4
|
ndmax = 4
|
||||||
if ndim > ndmax:
|
if ndim > ndmax:
|
||||||
raise ValueError("Too many dimensions.")
|
raise ValueError("Too many dimensions: %d > %d." % (ndim, ndmax))
|
||||||
|
|
||||||
size = shape[1], shape[0]
|
size = shape[1], shape[0]
|
||||||
if strides is not None:
|
if strides is not None:
|
||||||
|
@ -2018,7 +2018,7 @@ def open(fp, mode="r"):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if mode != "r":
|
if mode != "r":
|
||||||
raise ValueError("bad mode")
|
raise ValueError("bad mode %r" % mode)
|
||||||
|
|
||||||
if isPath(fp):
|
if isPath(fp):
|
||||||
filename = fp
|
filename = fp
|
||||||
|
@ -2054,7 +2054,8 @@ def open(fp, mode="r"):
|
||||||
#traceback.print_exc()
|
#traceback.print_exc()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
raise IOError("cannot identify image file")
|
raise IOError("cannot identify image file %r"
|
||||||
|
% (filename if filename else fp))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Image processing.
|
# Image processing.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user