提交 aefd29db authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix crash with more recent graphviz

上级 9a925e49
...@@ -25,7 +25,11 @@ except ImportError: ...@@ -25,7 +25,11 @@ except ImportError:
try: try:
# fall back on pydot if necessary # fall back on pydot if necessary
import pydot as pd import pydot as pd
if pd.find_graphviz(): if hasattr(pd, 'find_graphviz'):
if pd.find_graphviz():
pydot_imported = True
else:
pd.Dot.create(pd.Dot())
pydot_imported = True pydot_imported = True
except ImportError: except ImportError:
pass # tests should not fail on optional dependency pass # tests should not fail on optional dependency
......
...@@ -35,10 +35,14 @@ except ImportError: ...@@ -35,10 +35,14 @@ except ImportError:
try: try:
# fall back on pydot if necessary # fall back on pydot if necessary
import pydot as pd import pydot as pd
if pd.find_graphviz(): if hasattr(pd, 'find_graphviz'):
pydot_imported = True if pd.find_graphviz():
pydot_imported = True
else:
pydot_imported_msg = "pydot can't find graphviz"
else: else:
pydot_imported_msg = "pydot can't find graphviz" pd.Dot.create(pd.Dot())
pydot_imported = True
except ImportError: except ImportError:
# tests should not fail on optional dependency # tests should not fail on optional dependency
pydot_imported_msg = "Install the python package pydot or pydot-ng." pydot_imported_msg = "Install the python package pydot or pydot-ng."
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论