From e5160bd3732b881437bb7f6b5d5fbfaffc6fe69c Mon Sep 17 00:00:00 2001 From: Giovanni Cavallin <37183651+mawanda-jun@users.noreply.github.com> Date: Tue, 11 Sep 2018 10:30:42 +0200 Subject: [PATCH] From KeyError to ValueError when saving image When saving an image, if the extension is not determined it raises a ValueError (while internally it manages a KeyError) so I propose this change --- src/PIL/Image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index f13a98276..1ceabab45 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1894,7 +1894,7 @@ class Image(object): parameter should always be used. :param params: Extra parameters to the image writer. :returns: None - :exception KeyError: If the output format could not be determined + :exception ValueError: If the output format could not be determined from the file name. Use the format option to solve this. :exception IOError: If the file could not be written. The file may have been created, and may contain partial data.