But what if you do not want to give the user something obtuse like NameError or IOError. Python also provides a way to present customised error messages by using the built-in class Exception. To use it, simply plug "Exception" as the argument of raise.
"Where is the error message?" Well, I wanted you to see that you could raise a simple error by not giving any further arguments than "Exception". If you want to print something beyond this, enclose your message in quotes and separate it from "Exception" by a comma:
>>> raise Exception Traceback (most recent call last): File "<stdin>", line 1, in <module> Exception
>>> raise Exception, "This is my customised error message." Traceback (most recent call last): File "<stdin>", line 1, in <module> Exception: This is my customised error message.