summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graph.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/graph.py b/graph.py
index 9a77495..686a6ce 100644
--- a/graph.py
+++ b/graph.py
@@ -29,6 +29,7 @@ import os
import sys
import tempfile
import codecs
+import errno
def escape(value):
"""Make <value> usable in a dot file."""
@@ -114,13 +115,18 @@ class DotBackend:
use_shell = True
else:
use_shell = False
- if mapfile:
- subprocess.call([self.renderer, '-Tcmapx', '-o', mapfile, '-T', target, dot_sourcepath, '-o', outputfile],
- shell=use_shell)
- else:
- subprocess.call([self.renderer, '-T', target,
- dot_sourcepath, '-o', outputfile],
- shell=use_shell)
+ try:
+ if mapfile:
+ subprocess.call([self.renderer, '-Tcmapx', '-o', mapfile, '-T', target, dot_sourcepath, '-o', outputfile],
+ shell=use_shell)
+ else:
+ subprocess.call([self.renderer, '-T', target,
+ dot_sourcepath, '-o', outputfile],
+ shell=use_shell)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ e.strerror = 'File not found: {0}'.format(self.renderer)
+ raise
os.unlink(dot_sourcepath)
return outputfile