Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 Answers

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
like image 166
chtenb Avatar answered Sep 17 '25 20:09

chtenb