class_docstr: A hook to replace sys.excepthook that shows tracebacks in HTML.
code: def handle(self, info=None):
      info = info or sys.exc_info()
      if self.format == "html":
          self.file.write(reset())
  
      formatter = (self.format == "html") and html or text
      plain = False
      try:
          doc = formatter(info, self.context)
      except:  # just in case something goes wrong
          doc = "".join(traceback.format_exception(*info))
          plain = True
  
      if self.display:
          if plain:
              doc = pydoc.html.escape(doc)
              self.file.write("<pre>" + doc + "</pre>\n")
          else:
              self.file.write(doc + "\n")
      else:
          self.file.write("<p>A problem occurred in a Python script.\n")
  
      if self.logdir is not None:
          suffix = [".txt", ".html"][self.format == "html"]
          (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir)
  
          try:
              with os.fdopen(fd, "w") as file:
                  file.write(doc)
              msg = "%s contains the description of this error." % path
          except:
              msg = "Tried to save traceback to %s, but failed." % path
  
          if self.format == "html":
              self.file.write("<p>%s</p>\n" % msg)
          else:
              self.file.write(msg + "\n")
      try:
          self.file.flush()
      except:
          pass
  
imports: import inspect
  import keyword
  import linecache
  import os
  import pydoc
  import sys
  import tempfile
  import time
  import tokenize
  import traceback
  import warnings
  from html import escape
label_desc: Use image node_id 3 for calling the Hook obj's underlying member method code with example usage: obj.handle(info) without return types