From 2e752c68abe44ce65325f81660c2cdfb95f3ddca Mon Sep 17 00:00:00 2001 From: jsbautista <42411448+jsbautista@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:16:18 -0500 Subject: [PATCH] Update qtconsole/mainwindow.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Althviz Moré <16781833+dalthviz@users.noreply.github.com> --- qtconsole/mainwindow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qtconsole/mainwindow.py b/qtconsole/mainwindow.py index 2a53b131..4d5c86b6 100644 --- a/qtconsole/mainwindow.py +++ b/qtconsole/mainwindow.py @@ -813,9 +813,11 @@ def set_syntax_style(self, syntax_style): self.active_frontend._execute( f""" from IPython.core.ultratb import VerboseTB -try: +if getattr(VerboseTB, 'tb_highlight_style', None) is not None: + VerboseTB.tb_highlight_style = '{syntax_style}' +elif getattr(VerboseTB, '_tb_highlight_style', None) is not None: VerboseTB._tb_highlight_style = '{syntax_style}' -except AttributeError: +else: get_ipython().run_line_magic('colors', '{colors}') """, True)