hbmartin / graphviz2drawio

Convert graphviz (dot) files to draw.io / lucid (mxGraph) format. Beautiful and editable graphs in your favorite editor.
https://pypi.org/project/graphviz2drawio/
GNU General Public License v3.0
186 stars 32 forks source link

multiple calls to convert fail #15

Closed jcaplan closed 6 years ago

jcaplan commented 6 years ago

simple test:

from graphviz2drawio import graphviz2drawio as gv
for i in range(2):
    gv.convert("./test/directed/hello.gv.txt")

results in failure:

Error: syntax error in line 1 near '"'
Traceback (most recent call last):
  File "/home/jonah/.local/lib/python3.6/site-packages/pygraphviz/agraph.py", line 1201, in read
    self.handle = gv.agread(fh, None)
ValueError: agread: bad input data

Not sure why this causes a segfault in pytest but it looks like pygraphviz is not closing and reopening the file or otherwise properly resetting the read offset somewhere under the hood.

hbmartin commented 6 years ago

The problem was more simple 🙃 https://github.com/hbmartin/graphviz2drawio/commit/fde8f91c6ff0d54ef418a4d2762e5e414570aedc Strange that it even worked the first time.