I need to build a pythonic graph solution through pydot and when tried to run a simple code like:
import pydot
graph = pydot.Dot(graph_type='graph')
i=1
edge = pydot.Edge("A", "B%d" % i)
graph.add_edge(edge)
graph.write_png('graph.png')
Which is designed to build a simple graph (A-B1) on the png file. After fixing a lot of misconfigurations, now I got:
Traceback (most recent call last):
File "/Users/zallaricardo/Documents/Python/test_png.py", line 7, in <module>
graph.write_png('graph.png')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1809, in <lambda>
lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1911, in write
dot_fd.write(self.create(prog, format))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 2023, in create
status, stderr_output) )
pydot.InvocationException: Program terminated with status: 1. stderr follows: Format: "png" not recognized. Use one of:
logout
And till now could not find a straight solution to my particular environment. Any hint about how can I fix it? Need to work for python 2.7 and mac os x 10.9.
My current installed packages:
cycler==0.9.0
decorator==4.0.4
graphviz==0.4.7
matplotlib==1.5.0
networkx==1.10
numpy==1.10.1
pydot2==1.0.33
pyparsing==1.5.7
PyPDF2==1.25.1
python-dateutil==2.4.2
pytz==2015.7
six==1.10.0
wheel==0.26.0
I just would like to reach the same result shown in https://pythonhaven.wordpress.com/2009/12/09/generating_graphs_with_pydot/
write_raw
, and running the command manually, i.e.dot -Tjpeg -o/output/file -v /your/dot/file
. What is the output of that command? – Firepowerwrite_raw
but the output for thedot -Tjpeg - ...
is:dot - graphviz version 2.38.0 (20140413.2041) Format: "jpeg" not recognized. Use one of:
– AllometryUse one of:
list empty? What aboutdot -Tjpg:
? How did you install graphviz, from a dpkg or compiled it (with Homebrew/Macports)? Maybe your are hitting this bug, please try graphviz 2.39. – Firepowerdot -Tjpg:
the output isFormat: "jpg:" not recognized. Use one of:
. All the listsUse one of:
mentioned are empty. I usedpip install graphviz
through terminal, and after installing graphviz 2.39, running finally rendered the png file. Thanks @memoselyk! Now the output fordot -Tjpeg -
commands are full of graphviz stuff. – Allometry