how to kill a script if error is hit python

Solutions on MaxInterview for how to kill a script if error is hit python by the best coders in the world

showing results for - "how to kill a script if error is hit python"
Aarushi
27 May 2020
1import sys
2
3try:
4  print("stuff")
5except:
6  sys.exit(1) # exiing with a non zero value is better for returning from an error
7
similar questions