diff --git a/pybamm/expression_tree/symbol.py b/pybamm/expression_tree/symbol.py index cd3ec77acf..3bc390cc26 100644 --- a/pybamm/expression_tree/symbol.py +++ b/pybamm/expression_tree/symbol.py @@ -285,9 +285,13 @@ def visualise(self, filename): new_node, counter = self.relabel_tree(self, 0) - DotExporter( - new_node, nodeattrfunc=lambda node: 'label="{}"'.format(node.label) - ).to_picture(filename) + try: + DotExporter( + new_node, nodeattrfunc=lambda node: 'label="{}"'.format(node.label) + ).to_picture(filename) + except FileNotFoundError: + # raise error but only through logger so that test passes + pybamm.logger.error("Please install graphviz>=2.42.2 to use dot exporter") def relabel_tree(self, symbol, counter): """ Finds all children of a symbol and assigns them a new id so that they can be