I want to load a dot file to python,using this
graph = pydot.graph_from_dot_file(tmp1)
nodeList = graph.get_node_list()
but I got error when the label of nodes in the dot file is like:
398 [shape=diamond, fillcolor="#CCCCCC", label="(int)*value == '\\"'"];
error message is like this:
398 [shape=diamond, fillcolor="#CCCCCC", label="(int)*value == '\\\"'"]; ^ Expected "}" (at char 1800), (line:34, col:7) Traceback (most recent call last): File "dotchange.py", line 52, in <module> print dotchange(line) File "dotchange.py", line 13, in dotchange nodeList = graph.get_node_list() AttributeError: 'NoneType' object has no attribute 'get_node_list'
It seem that the escape character "\"
causes the error.
If I replace the label of the nodes containing "\"
with ""
,the error disappear.