Answers for "get traceback python"

1

print traceback python

import traceback
import sys

try:
    do_stuff()
except Exception:
    print(traceback.format_exc())
    # or
    print(sys.exc_info()[2])
Posted by: Guest on October-08-2021
2

traceback python

import traceback

try:
#Error prone code
	x=1/0
except Exception as e:
  	print(e)
	traceback.print_exc()
Posted by: Guest on June-26-2020

Python Answers by Framework

Browse Popular Code Answers by Language