From 124e42ade36c06931057789f4b2cf646c9cc65b3 Mon Sep 17 00:00:00 2001 From: Arjen Nienhuis Date: Sun, 7 Aug 2016 02:17:16 +0200 Subject: [PATCH] Improved error message for missing packer It's not that the raw mode does not exist. There is just no direct conversion. --- encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/encode.c b/encode.c index b08a9aa57..9a0dd2446 100644 --- a/encode.c +++ b/encode.c @@ -365,7 +365,7 @@ get_packer(ImagingEncoderObject* encoder, const char* mode, pack = ImagingFindPacker(mode, rawmode, &bits); if (!pack) { Py_DECREF(encoder); - PyErr_SetString(PyExc_SystemError, "unknown raw mode"); + PyErr_Format(PyExc_ValueError, "No packer found from %s to %s", mode, rawmode); return -1; }