<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I wasn't clear enough in my original post.<br>
<br>
I know how to raise a basic OSError or IOError, but what if I want to
raise specifically an "OSError: [Errno 2] No such file or directory"?<br>
Somehow it must be possible to raise the error with the correct
information to bring up the standard message, but where do I find the
right values to give?<br>
<br>
Thanks,<br>
-Dave<br>
<br>
<br>
alisonken1 wrote:
<blockquote
 cite="mid1145659457.805754.129340@u72g2000cwu.googlegroups.com"
 type="cite">
  <pre wrap="">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:

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">raise IOError("This raises an IOError")
        </pre>
      </blockquote>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: This raises an IOError

  </pre>
  <pre wrap=""><!---->
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.

  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Presenting:
mediocre nebula.
</pre>
</body>
</html>