To raise a specific error, just find the error that you want to raise,
then give the error a text string to print: ex.

raise IOError("This raises an IO error")

On the stderr output, when the routine hits this line, you will get:

>>> raise IOError("This raises an IOError")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: This raises an IOError

>>>

Just be sure of the error that you want to raise, since some of them
will do stuff like closing open file descriptors as well.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to