como matar um script se o erro for atingido python

import sys

try:
  print("stuff")
except:
  sys.exit(1) # exiing with a non zero value is better for returning from an error
Shy Seal