如何解决graphviz上的循环导入问题?

时间:2020-06-08 14:06:29

标签: python neo4j graphviz

我正在使用带有neo4j的graphviz软件包。当我尝试运行代码时,出现以下错误:

ImportError: cannot import name 'diGraph' from partially initialized module 'graphviz' (most likely due to a circular import)

代码如下:

from graphviz import diGraph 
from neo4j import GraphDatabase
def getCI(tx, dot, fontcolor, edge_width, show_lifecycle):
    ##building the graph here##
dot = diGraph(comment='Query Result')
dot.attr("graph",rankdir="LR",margin="0",compound="true", ratio="fill", size="8.3,11.7!")
with driver.session() as session:
 session.read_transaction(getCI, dot,  c_white, 8, False)


file = open("bpic14_query.dot","w") 
file.write(dot.source)
file.close()

有人可以帮我解决这个问题吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

from graphviz import diGraph 

应该;

from graphviz import Digraph 

认为可以解决问题,但也许我缺少了一些东西