Then when an exception occurs
You can create a code that you do.
Write down your main routine like this
import sys, traceback
def main():
try:
#This is where the main code goes.
except KeyboardInterrupt:
print "Shutdown requested...exiting"
except Exception:
traceback.print_exc(file=sys.stdout)
sys.exit(0)
if __name__ == "__main__":
main()
© 2024 OneMinuteCode. All rights reserved.