8000 Tweak _ConverterError reporting. by anntzer · Pull Request #22791 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Tweak _ConverterError reporting. #22791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
8000
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/matplotlib/testing/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _read_until(self, terminator):
while True:
c = self._proc.stdout.read(1)
if not c:
raise _ConverterError
raise _ConverterError(os.fsdecode(bytes(buf)))
buf.extend(c)
if buf.endswith(terminator):
return bytes(buf)
Expand All @@ -109,7 +109,8 @@ def __call__(self, orig, dest):
try:
self._read_until(b"\nGS")
except _ConverterError as err:
raise OSError("Failed to start Ghostscript") from err
raise OSError(
"Failed to start Ghostscript:\n\n" + err.args[0]) from None

def encode_and_escape(name):
return (os.fsencode(name)
Expand Down Expand Up @@ -172,8 +173,9 @@ def __call__(self, orig, dest):
try:
self._read_until(terminator)
except _ConverterError as err:
raise OSError("Failed to start Inkscape in interactive "
"mode") from err
raise OSError(
"Failed to start Inkscape in interactive mode:\n\n"
+ err.args[0]) from err

# Inkscape's shell mode does not support escaping metacharacters in the
# filename ("\n", and ":;" for inkscape>=1). Avoid any problems by
Expand Down
0