cudadog / pydot

Automatically exported from code.google.com/p/pydot
MIT License
0 stars 0 forks source link

Cannot run example #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'm trying to run this code using eclipse in ubuntu 11.10, which is an 
example in graphviz website:

# Import graphviz
import sys
sys.path.append('..')
sys.path.append('/usr/lib/graphviz/python/')
sys.path.append('/usr/lib/pymodules/python2.7/')
sys.path.append('/usr/lib64/graphviz/python/')
import gv

# Import pygraph
from pygraph.classes.graph import graph
from pygraph.classes.digraph import digraph
from pygraph.algorithms.searching import breadth_first_search
from pygraph.readwrite.dot import write

# Graph creation
gr = graph()

# Add nodes and edges
gr.add_nodes(["Portugal","Spain","France","Germany","Belgium","Netherlands","Ita
ly"])
gr.add_nodes(["Switzerland","Austria","Denmark","Poland","Czech 
Republic","Slovakia","Hungary"])
gr.add_nodes(["England","Ireland","Scotland","Wales"])

gr.add_edge(("Portugal", "Spain"))
gr.add_edge(("Spain","France"))
gr.add_edge(("France","Belgium"))
gr.add_edge(("France","Germany"))
gr.add_edge(("France","Italy"))
gr.add_edge(("Belgium","Netherlands"))
gr.add_edge(("Germany","Belgium"))
gr.add_edge(("Germany","Netherlands"))
gr.add_edge(("England","Wales"))
gr.add_edge(("England","Scotland"))
gr.add_edge(("Scotland","Wales"))
gr.add_edge(("Switzerland","Austria"))
gr.add_edge(("Switzerland","Germany"))
gr.add_edge(("Switzerland","France"))
gr.add_edge(("Switzerland","Italy"))
gr.add_edge(("Austria","Germany"))
gr.add_edge(("Austria","Italy"))
gr.add_edge(("Austria","Czech Republic"))
gr.add_edge(("Austria","Slovakia"))
gr.add_edge(("Austria","Hungary"))
gr.add_edge(("Denmark","Germany"))
gr.add_edge(("Poland","Czech Republic"))
gr.add_edge(("Poland","Slovakia"))
gr.add_edge(("Poland","Germany"))
gr.add_edge(("Czech Republic","Slovakia"))
gr.add_edge(("Czech Republic","Germany"))
gr.add_edge(("Slovakia","Hungary"))

# Draw as PNG
dot = write(gr)
gvv = gv.readstring(dot)
gv.layout(gvv,'dot')
gv.render(gvv,'png','europe.png')
2.
3.

What is the expected output? What do you see instead?
I expected the program would run smoothly. 
The error that shows up is because of this line:
from pygraph.readwrite.dot import write

Traceback (most recent call last):
  File "/home/jefferson/workspace/graph/example.py", line 13, in <module>
    from pygraph.readwrite.dot import write
ImportError: No module named dot

What version of the product are you using? On what operating system?
It's pydot 1.0.2 in ubuntu 11.10.

Please provide any additional information below.

I also tried to use the functions in pydot.py file like this:

from pydot.Dot import write
but I have this error:
Traceback (most recent call last):
  File "/home/jefferson/workspace/graph/example.py", line 14, in <module>
    from pydot.Dot import write
ImportError: No module named Dot

Waiting for some help

Regards

Original issue reported on code.google.com by jef...@gmail.com on 5 Mar 2012 at 2:42

GoogleCodeExporter commented 9 years ago
This is actually no issue with pydot but with pygraph.
"from pydot.Dot import write" should be "from pydot import Dot" and the write 
should then be "Dot.write" ;-)

"from pydot.Dot import write"
would work if there was a directory "pydot" which contains "Dot.py" and 
"__init__.py"

Original comment by ortenbur...@gmail.com on 22 Jun 2012 at 3:59

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 26 Jun 2012 at 9:40