From 57cf9b111f4b32705e35cca755e680030816a9ed 2017-06-02 17:09:32 From: Matthias Bussonnier Date: 2017-06-02 17:09:32 Subject: [PATCH] Merge pull request #10634 from mraduldubey/patch-1 fix of display() instantiates a shell in pure Python #10617 --- diff --git a/IPython/core/display.py b/IPython/core/display.py index ec3e9b0..0569134 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -279,6 +279,13 @@ def display(*objs, include=None, exclude=None, metadata=None, transient=None, di from IPython.display import display """ + from IPython.core.interactiveshell import InteractiveShell + + if not InteractiveShell.initialized(): + # Directly print objects. + print(*objs) + return + raw = kwargs.pop('raw', False) if transient is None: transient = {} @@ -293,8 +300,6 @@ def display(*objs, include=None, exclude=None, metadata=None, transient=None, di if transient: kwargs['transient'] = transient - from IPython.core.interactiveshell import InteractiveShell - if not raw: format = InteractiveShell.instance().display_formatter.format