diff options
author | David Douard <david.douard@logilab.fr> | 2014-09-01 12:42:16 +0200 |
---|---|---|
committer | David Douard <david.douard@logilab.fr> | 2014-09-01 12:42:16 +0200 |
commit | 6d7b9a64ec4547d9a82fec7ee857c68c26bfbf7d (patch) | |
tree | 81877ef3067f9505f54bed9b270c5271cb55c24b | |
parent | 381fe9c73ff45b5bb958e55b67880fd2c0f766e8 (diff) | |
download | logilab-common-6d7b9a64ec4547d9a82fec7ee857c68c26bfbf7d.tar.gz |
[graph] More explicit error message if dot is not found (closes #253516)
-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 |