python: suggest installing GraphViz when dot is not found
This fixes an issue mentioned in #375. * python/spot/aux.py (str_to_svg): Catch a missing 'dot' and instruct the user to install GraphViz. * THANKS: Add reporter.
This commit is contained in:
parent
573c593fa2
commit
188d210521
2 changed files with 13 additions and 5 deletions
1
THANKS
1
THANKS
|
|
@ -24,6 +24,7 @@ Jean-Michel Couvreur
|
||||||
Jean-Michel Ilié
|
Jean-Michel Ilié
|
||||||
Jeroen Meijer
|
Jeroen Meijer
|
||||||
Joachim Klein
|
Joachim Klein
|
||||||
|
Juan Tzintzun
|
||||||
Juraj Major
|
Juraj Major
|
||||||
Kristin Y. Rozier
|
Kristin Y. Rozier
|
||||||
Martin Dieguez Lodeiro
|
Martin Dieguez Lodeiro
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2016 Laboratoire de Recherche et Développement de l'Epita
|
# Copyright (C) 2016, 2019 Laboratoire de Recherche et Développement de l'Epita
|
||||||
# (LRDE).
|
# (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -51,10 +51,17 @@ def str_to_svg(str):
|
||||||
"""
|
"""
|
||||||
Send some text to dot for conversion to SVG.
|
Send some text to dot for conversion to SVG.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
dot = subprocess.Popen(['dot', '-Tsvg'],
|
dot = subprocess.Popen(['dot', '-Tsvg'],
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("The command 'dot' seems to be missing on your system.\n"
|
||||||
|
"Please install the GraphViz package "
|
||||||
|
"and make sure 'dot' is in your PATH.", file=sys.stderr)
|
||||||
|
raise
|
||||||
|
|
||||||
stdout, stderr = dot.communicate(str)
|
stdout, stderr = dot.communicate(str)
|
||||||
if stderr:
|
if stderr:
|
||||||
print("Calling 'dot' for the conversion to SVG produced the message:\n"
|
print("Calling 'dot' for the conversion to SVG produced the message:\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue