From 9822628ec4436fbbfc5b1d565ca39e83c202eb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=C3=BCrtz?= Date: Fri, 27 Jun 2014 13:22:49 +0200 Subject: [PATCH] backend_pgf: Error message for missing latex executable (fix #3051) --- lib/matplotlib/backends/backend_pgf.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 40fe207b4684..6ae2867b00a9 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -309,9 +309,13 @@ def __init__(self): self.texcommand = get_texcommand() self.latex_header = LatexManager._build_latex_header() latex_end = "\n\\makeatletter\n\\@@end\n" - latex = subprocess.Popen([self.texcommand, "-halt-on-error"], - stdin=subprocess.PIPE, stdout=subprocess.PIPE, - cwd=self.tmpdir) + try: + latex = subprocess.Popen([self.texcommand, "-halt-on-error"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + cwd=self.tmpdir) + except OSError: + raise RuntimeError("Error starting process '%s'" % self.texcommand) test_input = self.latex_header + latex_end stdout, stderr = latex.communicate(test_input.encode("utf-8")) if latex.returncode != 0: