55import os
66import queue
77import uuid
8- import re
98import sys
109import threading
1110import time
2221 from IPython .core .display import HTML
2322 from IPython .core .ultratb import FormattedTB
2423 from retrying import retry
25- from ansi2html import Ansi2HTMLConverter
2624 from ipykernel .comm import Comm
2725 import nest_asyncio
2826
@@ -450,13 +448,12 @@ def _wrap_errors(error):
450448 original_formatargvalues = inspect .formatargvalues
451449 inspect .formatargvalues = _custom_formatargvalues
452450 try :
453- # Use IPython traceback formatting to build colored ANSI traceback
454- # string
451+ # Use IPython traceback formatting to build the traceback string.
455452 ostream = io .StringIO ()
456453 ipytb = FormattedTB (
457454 tb_offset = skip ,
458455 mode = "Verbose" ,
459- color_scheme = "Linux " ,
456+ color_scheme = "NoColor " ,
460457 include_vars = True ,
461458 ostream = ostream ,
462459 )
@@ -465,27 +462,12 @@ def _wrap_errors(error):
465462 # Restore formatargvalues
466463 inspect .formatargvalues = original_formatargvalues
467464
468- # Print colored ANSI representation if requested
469- ansi_stacktrace = ostream .getvalue ()
465+ stacktrace = ostream .getvalue ()
470466
471467 if self .inline_exceptions :
472- print (ansi_stacktrace )
468+ print (stacktrace )
473469
474- # Use ansi2html to convert the colored ANSI string to HTML
475- conv = Ansi2HTMLConverter (scheme = "ansi2html" , dark_bg = False )
476- html_str = conv .convert (ansi_stacktrace )
477-
478- # Set width to fit 75-character wide stack trace and font to a size the
479- # won't require a horizontal scroll bar
480- html_str = html_str .replace (
481- "<html>" , '<html style="width: 75ch; font-size: 0.86em">'
482- )
483-
484- # Remove explicit background color so Dash dev-tools can set background
485- # color
486- html_str = re .sub ("background-color:[^;]+;" , "" , html_str )
487-
488- return html_str , 500
470+ return stacktrace , 500
489471
490472 @property
491473 def active (self ):
0 commit comments