diff --git a/ads/common/ipython.py b/ads/common/ipython.py index 36b548d3b..9b26d8a1d 100644 --- a/ads/common/ipython.py +++ b/ads/common/ipython.py @@ -63,14 +63,12 @@ def configure_plotting(): try: import IPython - + shell = IPython.get_ipython() global orig_ipython_traceback - if IPython.core.interactiveshell.InteractiveShell.showtraceback != _log_traceback: - orig_ipython_traceback = ( - IPython.core.interactiveshell.InteractiveShell.showtraceback - ) + if shell.showtraceback != _log_traceback: + orig_ipython_traceback = shell.showtraceback # Override the default showtraceback behavior of ipython, to show only the error message and log the stacktrace - IPython.core.interactiveshell.InteractiveShell.showtraceback = _log_traceback + shell.showtraceback = _log_traceback except ModuleNotFoundError: pass diff --git a/ads/common/model.py b/ads/common/model.py index 2783a9d21..1c059c954 100644 --- a/ads/common/model.py +++ b/ads/common/model.py @@ -633,10 +633,8 @@ def show_in_notebook(self): "display.precision", 4, ): - from IPython.display import HTML - + from IPython.display import HTML, display from ads.common.utils import get_display - display = get_display() display(HTML(info_df.to_html(index=False, header=False))) return info