1import traceback
2
3try:
4 do_stuff()
5except Exception as err:
6 print(err, traceback.format_exc())
7
1import traceback
2
3try:
4#Error prone code
5 x=1/0
6except Exception as e:
7 print(e)
8 traceback.print_exc()
1import traceback
2
3try:
4 raise TypeError("Oups!")
5except Exception, err:
6 try:
7 raise TypeError("Again !?!")
8 except:
9 pass
10
11 traceback.print_exc()