问题
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