在python中加载两个点文件时出错

时间:2015-11-25 10:59:16

标签: python networkx dot

如何在python中加载两个单独的dot.files。 我是这样尝试但是我得到了一个错误。

#import pygraphviz as pgv
import networkx as nx   
#import matplotlib.pyplot as plt
Gtmp1 = nx.read_dot("case1.dot")
Gtmp2 = nx.read_dot("case2.dot")

错误:

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Graphs.py", line 196, in <module>
    Gtmp2 = nx.read_dot("case2.dot")
File "/home/thinkpad/anaconda3/lib/python3.4/site-packages/networkx/drawing/nx_agraph.py", line 197, in read_dot
    A=pygraphviz.AGraph(file=path)
  File "/home/thinkpad/anaconda3/lib/python3.4/site-packages/pygraphviz/agraph.py", line 162, in __init__
self.read(filename)
  File "/home/thinkpad/anaconda3/lib/python3.4/site-packages/pygraphviz /agraph.py", line 1203, in read
raise DotError
pygraphviz.agraph.DotError

0 个答案:

没有答案