Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

pydot

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?

like image 424
yoki Avatar asked Dec 04 '25 18:12

yoki


1 Answers

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.

like image 143
eternalmothra Avatar answered Dec 06 '25 09:12

eternalmothra