Off the bat - Ubuntu 12.04, python 2.7, using pydot 1.0.2
I\'m trying to get pydot to print a tree to a .png. I\'m making my nodes like so:
subnode = py
There's a difference between "\n"
, a newline, vs r"\n"
, the two characters backslash and n
. The latter is a raw string, and is especially useful for regular expressions.
As to why one string works and the other doesn't: the pydot
library is "dumb", it's just reformatting commands for an external dot
service. The newline in the middle of commands to dot confuses it, thus the "syntax error" and other issues.
Here's the patched code:
subnode = pydot.Node(fullstr, label = c + r"\n" + n)
graph.add_node(subnode)