From 65533d86425f6b661cfd8d9fd7a7ff26f2786680 Mon Sep 17 00:00:00 2001 From: Jakub Kuszneruk Date: Wed, 16 Jun 2021 16:25:54 +0200 Subject: [PATCH] Check `get_ipython()` for `None` (#598) --- CHANGELOG.md | 5 +++++ neptune/new/internal/utils/runningmode.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93821d15f..272aa6cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## neptune-client 0.9.18 + +### Fixes +- Check get_ipython() for None ([#598](https://github.com/neptune-ai/neptune-client/pull/598)) + ## neptune-client 0.9.17 ### Features diff --git a/neptune/new/internal/utils/runningmode.py b/neptune/new/internal/utils/runningmode.py index e058ed2c3..c188296a2 100644 --- a/neptune/new/internal/utils/runningmode.py +++ b/neptune/new/internal/utils/runningmode.py @@ -26,8 +26,12 @@ def in_notebook(): """Based on: https://stackoverflow.com/a/22424821/1565454""" try: from IPython import get_ipython - if 'IPKernelApp' not in get_ipython().config: # pragma: no cover + ipy = get_ipython() + if ipy is None \ + or not hasattr(ipy, 'config') or not isinstance(ipy.config, dict) \ + or 'IPKernelApp' not in ipy.config: return False except ImportError: return False + return True