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