From d0280a65387bbfbd70f28c24b6ae17f2d5c496d6 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 c58952657..2b248ab3e 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.