From 13ef66e85fc36e93f95baeb0ac9b7d8902ffc5b3 Mon Sep 17 00:00:00 2001 From: S Jenkins <69673492+nopdive@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:14:38 -0800 Subject: [PATCH] [Bug] Fix for environment detection in barebones environments. (#1076) --- guidance/visual/_environment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guidance/visual/_environment.py b/guidance/visual/_environment.py index ce35a70af..fc10b35cc 100644 --- a/guidance/visual/_environment.py +++ b/guidance/visual/_environment.py @@ -102,7 +102,7 @@ def _detect_ipython(flags: EnvFlags) -> bool: try: from IPython import get_ipython found = get_ipython() is not None - except NameError: # pragma: no cover + except (NameError, ImportError): # pragma: no cover pass return found @@ -129,7 +129,7 @@ def _detect_ipython_zmq(flags: EnvFlags) -> bool: found = False # Terminal running IPython else: found = False # Other type (?) - except NameError: # pragma: no cover + except (NameError, ImportError): # pragma: no cover found = False # Probably standard Python interpreter flags.is_notebook |= found