mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-18 19:24:47 +03:00
more explicit error message when saving to a file with invalid extension
This commit is contained in:
parent
0f9233623e
commit
955f6848fd
|
@ -1715,7 +1715,10 @@ class Image(object):
|
||||||
if not format:
|
if not format:
|
||||||
if ext not in EXTENSION:
|
if ext not in EXTENSION:
|
||||||
init()
|
init()
|
||||||
|
try:
|
||||||
format = EXTENSION[ext]
|
format = EXTENSION[ext]
|
||||||
|
except KeyError:
|
||||||
|
raise ValueError('unknown file extension: {}'.format(ext))
|
||||||
|
|
||||||
if format.upper() not in SAVE:
|
if format.upper() not in SAVE:
|
||||||
init()
|
init()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user