i want to use graphviz ,but error 'syntax error in line 1 near '{''

本秂侑毒 提交于 2019-12-24 06:25:19

问题


i use macOS

already $ brew install graphviz

so, i can use dot -V

⇨ dot - graphviz version 2.40.1 (20161225.0304)

i made [test.dot] file on Desktop,and dot -T png -O test.dot but , Error: test.dot: syntax error in line 1 near '{' occured

please help

test.dot

digraph d {
 A [label="Hello"]
 B [label="World"]
 C [label="Everyone"]
 A -> { B C }
}

As a matter of concern, opening a file opens in a word


回答1:


It may be due to line endings or BOM markers. I get

$ cat PruneGraph.dot  | dot.exe
Error: <stdin>: syntax error in line 1 near 'digraph'

but the following fixes it:

$ cat PruneGraph.dot | dos2unix.exe  | dot.exe



回答2:


I have tried your example in different environments. The example is valid. As user882813 stated, it could be that your file is not plain ASCII and there are special character you probably not see directly. Use a plain ASCI-Editor, for e.g. vscode, and try again.



来源:https://stackoverflow.com/questions/48645375/i-want-to-use-graphviz-but-error-syntax-error-in-line-1-near

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!