Python cgitb enable method














































Python cgitb enable method



python cgitb enable method

The 'cgitb' module provides us detailed information on error, 'enable' method to activate this module.

Description

enable(display=1, logdir=None, context=5, format="html")
This function enable 'cgitb' module take over the interpreters default exception handling by setting the value of 'sys.excepthook'.
'display' is a optional parameter with default value of '1' and if we want to suppress sending the traceback to the browser change it to '0'.

Note

If 'logdir' is present, the traceback reports are written to files specific directory provided by 'logdir'.

Parameter 'format' is optional with default value as 'html'.

Example

import cgitb
cgitb.enable(format='text')

def func3(arg1):
value = arg2 / 2
return local_var

func3(1)



Comments