diff --git a/src/imgkit/imgkit.py b/src/imgkit/imgkit.py index 67b56cd..6d1606a 100644 --- a/src/imgkit/imgkit.py +++ b/src/imgkit/imgkit.py @@ -239,7 +239,10 @@ def to_img(self, path=None): string = None stdout, stderr = result.communicate(input=string) stderr = stderr or stdout - stderr = stderr.decode("utf-8") + try: + stderr = stderr.decode("utf-8") + except UnicodeDecodeError: + stderr = "" exit_code = result.returncode if "cannot connect to X server" in stderr: