traceback cetak python dari pengecualian
import traceback
try:
do_stuff()
except Exception as err:
print(err, traceback.format_exc())
FishBrawler
import traceback
try:
do_stuff()
except Exception as err:
print(err, traceback.format_exc())
import traceback
try:
#Error prone code
x=1/0
except Exception as e:
print(e)
traceback.print_exc()
import traceback
try:
raise TypeError("Oups!")
except Exception, err:
try:
raise TypeError("Again !?!")
except:
pass
traceback.print_exc()