pombreda / pydot

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

pydot fails to write graph image for nodes with labels containing 'graph' #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
[Python code]
import pydot
graph = pydot.Dot('class dependency', graph_type='digraph')
graph.add_node(pydot.Node('graph'))
graph.write_png('output.png')

What is the expected output? What do you see instead?
Expected output:
A png image containing the single node labelled 'graph'

Actual output:
blank image (for node labelled 'graph')

or

exception (for node labelled 'digraph'), reproduced below:
Traceback (most recent call last):
  File "main.py", line 110, in <module>
    graph.write_png('output.png')
  File "/opt/local/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 "/opt/local/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 "/opt/local/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: 80. stderr follows: 
Error: /var/folders/1n/351b28yx50ldhb3sh5w9flvh0000gn/T/tmpqzC4kG:2: syntax 
error near line 2
context:  >>> digraph <<< ;

What version of the product are you using? On what operating system?
Python 2.7, pydot 1.0.28, on Mac OS X 10.7.4

Please provide any additional information below.
NA

Original issue reported on code.google.com by evandrix on 28 May 2012 at 8:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
there are 2 issues here:
first a dotname containing spaces
second a node name with a restricted name

both can be fixed on your side with the use of double quotes:
import pydot
graph = pydot.Dot('"class dependency"', graph_type='digraph')
graph.add_node(pydot.Node('"graph"'))
graph.write_png('output.png')

This is actually no issue with pydot, but with the dot language, pydot could 
fix it with automatically add doublequotes evrywhere.

There already is a patch for this, see issue 61.

Original comment by ortenbur...@gmail.com on 22 Jun 2012 at 4:45

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 3 Jul 2012 at 10:38