Skip to content

Commit

Permalink
Ensure that graphviz is an optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-blanchard committed Sep 2, 2016
1 parent 30c6d70 commit 5e94744
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions streamparse/cli/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

try:
import graphviz
HAVE_GRAPHVIZ = True
except:
raise ImportError('The visualize command requires the `graphviz` Python '
'library and `graphviz` system library to be installed.')
HAVE_GRAPHVIZ = False


IPYTHON_IMAGE_FORMATS = frozenset(['jpeg', 'png'])
Expand All @@ -26,6 +26,10 @@

def to_graphviz(topology_class, node_attr=None, edge_attr=None, **kwargs):
"""Convert a Topology into a DiGraph"""
if not HAVE_GRAPHVIZ:
raise ImportError('The visualize command requires the `graphviz` Python'
' library and `graphviz` system library to be '
'installed.')
attributes = {'fontsize': '16',
'fontcolor': 'white',
'bgcolor': '#333333',
Expand Down

0 comments on commit 5e94744

Please sign in to comment.