Skip to content

Commit a79bab0

Browse files
committed
Merge pull request #3158 from pwuertz/fix_3051
backend_pgf: Error message for missing latex executable (fix #3051)
2 parents 3ec5704 + 9822628 commit a79bab0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,13 @@ def __init__(self):
309309
self.texcommand = get_texcommand()
310310
self.latex_header = LatexManager._build_latex_header()
311311
latex_end = "\n\\makeatletter\n\\@@end\n"
312-
latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
313-
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
314-
cwd=self.tmpdir)
312+
try:
313+
latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
314+
stdin=subprocess.PIPE,
315+
stdout=subprocess.PIPE,
316+
cwd=self.tmpdir)
317+
except OSError:
318+
raise RuntimeError("Error starting process '%s'" % self.texcommand)
315319
test_input = self.latex_header + latex_end
316320
stdout, stderr = latex.communicate(test_input.encode("utf-8"))
317321
if latex.returncode != 0:

0 commit comments

Comments
 (0)