Python graphviz - pydot.Dot.write_png doesn't work on Windows

yoki picture yoki · May 8, 2013 · Viewed 7.2k times · Source

I am using Python to create a graph via pydot.Dot.

When I want to write the graph to PNG, I use pydot.Dot.write_png(...). Unfortunately, it fails at the stage of finding graphviz (in a function called find_graphviz).

I tried installing it as a software but I don't see how it can be imported to Python.

How can I solve this problem?

Answer

eternalmothra picture eternalmothra · Jan 20, 2015

Even after adding Graphviz to my PATH, it wasn't working. I ended up going into the pydot.py file and commenting out everything in find_graphviz() and writing in the line:

`return {'dot': 'C:\\Program Files\\graphviz-2.38\\bin\\dot.exe'}`

That's where my dot file was located, you might have it in a different location.