How to stop a Python script without error messages on the shell? -


I want to stop a python script to see an error message.
I do not want an error message on the shell (). How to do it ???

When you CTRL + C in a Python script, KeyboardInterrupt raises an exception, so that you can do something

  Try: ... the job goes here ... Except keyboard interrupt: sys.exit (0) < / Code> 

Comments