diff options
-rw-r--r-- | graph.py | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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 |