A traceback is a report of the actions leading up to a run-time error in the execution of a program.
A traceback is a report of the actions leading up to a run-time error in the execution of a program. For example, the following traceback:
Traceback (most recent call last):
File "convert.py", line 23, in <module>
display(literal_eval(sys.argv[1]), *sys.argv[2:])
File "convert.py", line 16, in display
result = convert(quantity, from_unit, to_unit)
File "convert.py", line 10, in convert
conversion = CONVERSIONS[from_unit, to_unit]
KeyError: ('cm', 'inch')
shows that in the Python program convert.py
, the function display()
was called, which in turn called the function convert()
, which attempted to look up a nonexistent item with the key ('cm', 'inch')
in the dictionary CONVERSIONS
.
Reporting the actions leading up to an error, rather than just the line on which the error occurred, can assist in debugging a faulty program.