Skip to content

Commit c20f09e

Browse files
authored
Refactor IPython traceback handling
1 parent b1585d5 commit c20f09e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ads/common/ipython.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,12 @@ def configure_plotting():
6363

6464
try:
6565
import IPython
66-
66+
shell = IPython.get_ipython()
6767
global orig_ipython_traceback
68-
if IPython.core.interactiveshell.InteractiveShell.showtraceback != _log_traceback:
69-
orig_ipython_traceback = (
70-
IPython.core.interactiveshell.InteractiveShell.showtraceback
71-
)
68+
if shell.showtraceback != _log_traceback:
69+
orig_ipython_traceback = shell.showtraceback
7270

7371
# Override the default showtraceback behavior of ipython, to show only the error message and log the stacktrace
74-
IPython.core.interactiveshell.InteractiveShell.showtraceback = _log_traceback
72+
shell.showtraceback = _log_traceback
7573
except ModuleNotFoundError:
7674
pass

0 commit comments

Comments
 (0)