0

I am using python and pydotplus to read a dot file, but there is an error when I am loading it:

Expected "}", found '['  (at char 226), (line:7, col:10)

I checked it and found it was caused by '\"' in an attribute of the node. The dot file is as follows:

digraph "checkChessboardBinary"
{
 // LATEX_PDF_SIZE
  edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"];
  node [fontname="Helvetica",fontsize="10",shape=record];
  rankdir="LR";
  Node62 [label="cvmorphologyDefaultBorderValue",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$group__imgproc__filter.html#ga94756fad83d9d24d29c9bf478558c40a",tooltip="returns \"magic\" border value for erosion and dilation. It is automatically transformed to Scalar::all..."];
}

The dot file is generated by doxygen, and \" in tooltip="returns \"magic\" borde caused the error.

I hope you can help me read the file with pydotplus and do not modify it.

  • So the problem is that doxygen needs to translate the double quotes (`"`) that are used in the original code to `\"` as otherwise the used tooltip is not properly formatted. A workaround might be to use in your original code single quotes (`'`) or better adjust the python code that reads the dot file so that it does understand double quoted strings with inside escaped double quotes. – albert Nov 21 '19 at 15:31
  • @albert Actually, I do not need the information of tooltip. So, can I set doxygen not to generate dot file including tooltip? How can I do? – xiaoyao Don Nov 21 '19 at 15:37
  • It might be that `SOURCE_TOOLTIP=NO` does the trick (I haven't had time to test it yet), so please give it a try and report back. – albert Nov 21 '19 at 17:15
  • Just ran a small test and setting `SOURCE_TOOLTIP=NO` doesn't help (the brief description is always used as far as I can see in the code). The construct with `\"` as a completely valid construct for the tooltip and this way it should also be supported by the read routine from python / pydotplus. Without a line number and (python) filename / code it is hard to tell what is wrong during the read. – albert Nov 21 '19 at 17:37

0 Answers0