From e01f10720684d31c302677cf7778ea61ef9e6fee Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 28 Jul 2019 14:56:48 +0200 Subject: [PATCH] Gracefully handle encoding problems when querying external executables. --- lib/matplotlib/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 8103bc3d672d..99b24483eadd 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -330,7 +330,8 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False): # at least min_ver (if set); else, raise ExecutableNotFoundError. try: output = subprocess.check_output( - args, stderr=subprocess.STDOUT, universal_newlines=True) + args, stderr=subprocess.STDOUT, + universal_newlines=True, errors="replace") except subprocess.CalledProcessError as _cpe: if ignore_exit_code: output = _cpe.output