How to use the graphviz.backend function in graphviz

To help you get started, we’ve selected a few graphviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrefectHQ / prefect / src / prefect / core / flow.py View on Github external
graph.render(filename, view=False)
        else:
            try:
                from IPython import get_ipython

                assert get_ipython().config.get("IPKernelApp") is not None
            except Exception:
                with tempfile.NamedTemporaryFile(delete=False) as tmp:
                    tmp.close()
                    try:
                        graph.render(tmp.name, view=True)
                    except graphviz.backend.ExecutableNotFound:
                        msg = "It appears you do not have Graphviz installed, or it is not on your PATH.\n"
                        msg += "Please install Graphviz from http://www.graphviz.org/download/\n"
                        msg += "And note: just installing the `graphviz` python package is not sufficient!"
                        raise graphviz.backend.ExecutableNotFound(msg)
                    finally:
                        os.unlink(tmp.name)

        return graph
github xflr6 / graphviz / graphviz / files.py View on Github external
def engine(self, engine):
        engine = engine.lower()
        if engine not in backend.ENGINES:
            raise ValueError('unknown engine: %r' % engine)
        self._engine = engine