I\'ve seen people suggesting sys.exit() in Python. My question is that, is there any other way to exit the execution of current script, I mean termination, with an error.
Calling sys.exit with a string will work. The docs mention this use explicitly:
sys.exit
In particular, sys.exit("some error message") is a quick way to exit a program when an error occurs.