Skip to content

Commit 41efb46

Browse files
committed
Merge pull request #4022 from nwin/patch-1
More helpful error message for pgf backend
2 parents 9408937 + 2cea256 commit 41efb46

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/matplotlib/backends/backend_pgf.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import math
77
import os
88
import sys
9+
import errno
910
import re
1011
import shutil
1112
import tempfile
@@ -316,8 +317,14 @@ def __init__(self):
316317
stdin=subprocess.PIPE,
317318
stdout=subprocess.PIPE,
318319
cwd=self.tmpdir)
319-
except OSError:
320-
raise RuntimeError("Error starting process '%s'" % self.texcommand)
320+
except OSError as e:
321+
if e.errno == errno.ENOENT:
322+
raise RuntimeError("Latex command not found. "
323+
"Install '%s' or change pgf.texsystem to the desired command."
324+
% self.texcommand
325+
)
326+
else:
327+
raise RuntimeError("Error starting process '%s'" % self.texcommand)
321328
test_input = self.latex_header + latex_end
322329
stdout, stderr = latex.communicate(test_input.encode("utf-8"))
323330
if latex.returncode != 0:

0 commit comments

Comments
 (0)