From 7fb2e8b64dd12a61109abdad341bbf63888a0ce6 Mon Sep 17 00:00:00 2001 From: Ramesh Sampath <1437573+sampathweb@users.noreply.github.com> Date: Thu, 7 Mar 2024 22:33:32 -0600 Subject: [PATCH] Fix the error handling for pydot installation check. (#763) `pydot.InvocationException` is only in `pydot_ng` and not in the `pydot` library. PiperOrigin-RevId: 613787427 --- tf_keras/utils/vis_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tf_keras/utils/vis_utils.py b/tf_keras/utils/vis_utils.py index f5537462a..e3145630a 100644 --- a/tf_keras/utils/vis_utils.py +++ b/tf_keras/utils/vis_utils.py @@ -56,7 +56,10 @@ def check_graphviz(): # to check the pydot/graphviz installation. pydot.Dot.create(pydot.Dot()) return True - except (OSError, pydot.InvocationException): + except (OSError, FileNotFoundError): + return False + # pydot_ng has InvocationException but pydot doesn't + except pydot.InvocationException: return False