Skip to content

Commit

Permalink
Added support for new pydot versions to fix find_graphviz error (#6398)
Browse files Browse the repository at this point in the history
* Added support for the new pydot API to fix find_graphviz error

* Simplified pydot installation checking

* Workaround for pydot generic Exception raising

* Removed hacky workaround for pyplot Exception, included comment
  • Loading branch information
pnb authored and fchollet committed Apr 26, 2017
1 parent 5e51d02 commit 54a417f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keras/utils/vis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@


def _check_pydot():
if not (pydot and pydot.find_graphviz()):
try:
# Attempt to create an image of a blank graph to check the pydot/graphviz installation.
pydot.Dot.create(pydot.Dot())
except Exception: # pydot raises a generic Exception here, so no specific class can be caught.
raise ImportError('Failed to import pydot. You must install pydot'
' and graphviz for `pydotprint` to work.')

Expand Down

0 comments on commit 54a417f

Please sign in to comment.