{
    "mode": "pydoc",
    "parameter": "cgitb",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/cgitb/json",
    "generated": "2026-06-02T15:02:06Z",
    "sections": {
        "NAME": {
            "content": "cgitb - More comprehensive traceback formatting for Python scripts.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/cgitb.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "To enable this module, do:\n\nimport cgitb; cgitb.enable()\n\nat the top of your script.  The optional arguments to enable() are:\n\ndisplay     - if true, tracebacks are displayed in the web browser\nlogdir      - if set, tracebacks are written to files in this directory\ncontext     - number of lines of source code to show for each stack frame\nformat      - 'text' or 'html' controls the output format\n\nBy default, tracebacks are displayed but not saved, the context is 5 lines\nand the output format is 'html' (for backwards compatibility with the\noriginal use of this module)\n\nAlternatively, if you have caught an exception and want cgitb to display it\nfor you, call cgitb.handler().  The optional argument to handler() is a\n3-item tuple (etype, evalue, etb) just like the value of sys.excinfo().\nThe default handler displays output as HTML.\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.object\nHook\n",
            "subsections": [
                {
                    "name": "class Hook",
                    "content": "|  Hook(display=1, logdir=None, context=5, file=None, format='html')\n|\n|  A hook to replace sys.excepthook that shows tracebacks in HTML.\n|\n|  Methods defined here:\n|\n|  call(self, etype, evalue, etb)\n|      Call self as a function.\n|\n|  init(self, display=1, logdir=None, context=5, file=None, format='html')\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  handle(self, info=None)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "enable",
                    "content": "Install an exception handler that formats tracebacks as HTML.\n\nThe optional argument 'display' can be set to 0 to suppress sending the\ntraceback to the browser, and 'logdir' can be set to a directory to cause\ntracebacks to be written to files there.\n"
                },
                {
                    "name": "grey",
                    "content": "handler = handle(info=None) method of Hook instance\n"
                },
                {
                    "name": "html",
                    "content": "Return a nice HTML document describing a given traceback.\n"
                },
                {
                    "name": "lookup",
                    "content": "Find the value for a given name in the given environment.\n"
                },
                {
                    "name": "reset",
                    "content": "Return a string that resets the CGI and browser to a known state.\n"
                },
                {
                    "name": "scanvars",
                    "content": "Scan one logical line of Python and look up values of variables used.\n"
                },
                {
                    "name": "small",
                    "content": ""
                },
                {
                    "name": "strong",
                    "content": ""
                },
                {
                    "name": "text",
                    "content": "Return a plain text document describing a given traceback.\n"
                }
            ]
        },
        "DATA": {
            "content": "UNDEF = []\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/cgitb.py\n\n",
            "subsections": []
        }
    },
    "summary": "cgitb - More comprehensive traceback formatting for Python scripts.",
    "flags": [],
    "examples": [],
    "see_also": []
}