提交 d6545295 authored 作者: Christof Angermueller's avatar Christof Angermueller

Update pydot import check

上级 85f80d51
from theano.d3viz.d3viz import d3viz, d3write
has_requirements = True
has_requirements = False
try:
import pydot
import pydot as pd
if pd.find_graphviz():
has_requirements = True
except ImportError:
has_requirements = False
pass
......@@ -14,11 +14,13 @@ from theano.compile.profilemode import ProfileMode
from theano.compile import Function
from theano.compile import builders
pydot_installed = True
pydot_imported = False
try:
import pydot as pd
if pd.find_graphviz():
pydot_imported = True
except ImportError:
pydot_installed = False
pass
class PyDotFormatter(object):
......@@ -41,7 +43,7 @@ class PyDotFormatter(object):
def __init__(self, compact=True):
"""Construct PyDotFormatter object."""
if not pydot_installed:
if not pydot_imported:
raise ImportError('Failed to import pydot. Please install pydot!')
self.compact = compact
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论