5
5
import os
6
6
import queue
7
7
import uuid
8
- import re
9
8
import sys
10
9
import threading
11
10
import time
22
21
from IPython .core .display import HTML
23
22
from IPython .core .ultratb import FormattedTB
24
23
from retrying import retry
25
- from ansi2html import Ansi2HTMLConverter
26
24
from ipykernel .comm import Comm
27
25
import nest_asyncio
28
26
@@ -450,13 +448,12 @@ def _wrap_errors(error):
450
448
original_formatargvalues = inspect .formatargvalues
451
449
inspect .formatargvalues = _custom_formatargvalues
452
450
try :
453
- # Use IPython traceback formatting to build colored ANSI traceback
454
- # string
451
+ # Use IPython traceback formatting to build the traceback string.
455
452
ostream = io .StringIO ()
456
453
ipytb = FormattedTB (
457
454
tb_offset = skip ,
458
455
mode = "Verbose" ,
459
- color_scheme = "Linux " ,
456
+ color_scheme = "NoColor " ,
460
457
include_vars = True ,
461
458
ostream = ostream ,
462
459
)
@@ -465,27 +462,12 @@ def _wrap_errors(error):
465
462
# Restore formatargvalues
466
463
inspect .formatargvalues = original_formatargvalues
467
464
468
- # Print colored ANSI representation if requested
469
- ansi_stacktrace = ostream .getvalue ()
465
+ stacktrace = ostream .getvalue ()
470
466
471
467
if self .inline_exceptions :
472
- print (ansi_stacktrace )
468
+ print (stacktrace )
473
469
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
489
471
490
472
@property
491
473
def active (self ):
0 commit comments