diff --git a/safety/auth/utils.py b/safety/auth/utils.py index bc0c385b..663c3a08 100644 --- a/safety/auth/utils.py +++ b/safety/auth/utils.py @@ -441,6 +441,6 @@ def is_jupyter_notebook() -> bool: shell = get_ipython() # Check for the presence of 'IPKernelApp', indicating a Jupyter notebook environment. return 'IPKernelApp' in shell.config - except (NameError, AttributeError): + except (ImportError, NameError, AttributeError): # IPython is not available or has no `config` attribute; likely not a notebook. return False