offending-dot-string.dot) and manually running it through the GraphViz executable.
Once you have your DOT string, you can test if you got the right one (the one that caused the error) by saving it in a text file (e.g. In case you are really not able to get hold of the DOT string, supply your source code instead (see below). Alternatively, you can prevent the deletion of the tmp-file by commenting out os.unlink(tmp_name) at line 1930 of pydot.py (pydot 1.4.1).Replace your call to some_graph.write_png() (or whatever other write_.-method you are calling) by print(some_graph.to_string()).
As mentioned by in an earlier comment, you can edit your own source code.For now, though, you need to capture your DOT string yourself and here are two different methods for doing that: I think it would be very useful if in the future pydot would print the DOT string right along with the GraphViz error. The DOT string usually consists of multiple lines, for example: To better determine your issue, we need to know what DOT string pydot generates. However, since there are many ways of not complying with the DOT language specification and the GraphViz error message is quite terse and generic, you still cannot always say for sure that you are experiencing the same issue as others seeing a similar message. So, if you see a syntax error about a tmp-file, the problem is probably with the DOT string generated by pydot. The tmp-file is written by pydot especially to serve as input for GraphViz. The tmp-file is a text file describing the graph in the DOT language ( Wikipedia, Specification). In this case, GraphViz complains about the tmp-file. Below stdout, stderr is the error that GraphViz reported. "dot" with args returned code: 1Įrror: /tmp/tmpgIPxNG: syntax error in line 2 near '>'Īt the top, it shows which GraphViz executable was called and with which arguments. I reran everything again and it only works on python 3, otherwise I get this error:
I'm not sure where the problem is in this case, but in the thread are many files included for debugging.Įdit: It looks like this is some unicode problem with python 2. I tested the very same code with python 3 and 2.7.15 and also 2.7.13, graphviz 2.34 and 2.38 and pydot 1.4.1 but it works for me. S = self.create(prog, format, encoding=encoding)įile "C:\Users\XXX\.windows-build-tools\python27\lib\site-packages\pydot.py", line 1884, in create Getattr(g, "write_" + _format.lower())(output)įile "C:\Users\XXX\.windows-build-tools\python27\lib\site-packages\pydot.py", line 1673, in new_methodįile "C:\Users\XXX\.windows-build-tools\python27\lib\site-packages\pydot.py", line 1756, in write Method2format(filename + "." + form, form, None, buff)įile "C:\Users\XXX\.windows-build-tools\python27\lib\site-packages\androguard\core\bytecode.py", line 393, in method2format Plt.text(avgy - 0.3, avgx, variable, fontdict=font)įile "C:\Users\XXX\.windows-build-tools\python27\Scripts\androdd.py", line 175, in įile "C:\Users\XXX\.windows-build-tools\python27\Scripts\androdd.py", line 109, in export_apps_to_format ParentGraphNode = pydot.Node(str(self.index), shape="plaintext",ĭef generateDiagram(self, rootNode, currentNode):įor (posx, posy) in CSP.positions: aph = pydot.Dot(graph_type='graph', dpi=300)ĭef createGraph(self, node, currentNode): # this class creates tree plot for search tree