wf: don't crash if graphviz is not installed

This commit is contained in:
Thomas NOËL 2012-08-29 12:56:00 +02:00
parent 46f142df1e
commit 4d01005c77
1 changed files with 5 additions and 2 deletions

View File

@ -134,8 +134,11 @@ def graphviz(workflow, url_prefix='', select=None, svg=True,
print >>out, '}'
out = out.getvalue()
if svg:
process = Popen(['dot', '-Tsvg', '/dev/stdin'], stdin=PIPE, stdout=PIPE)
out, err = process.communicate(out)
try:
process = Popen(['dot', '-Tsvg', '/dev/stdin'], stdin=PIPE, stdout=PIPE)
out, err = process.communicate(out)
except OSError:
return ''
if include:
out = graphviz_post_treatment(out)
# It seems webkit refuse to accept SVG when using its proper namespace,