title: Is there a cross-platform way of getting information from Python's OSError?
body: <p>On a simple directory creation operation for example, I can make an OSError like this:</p>
  
  <p>(Ubuntu Linux)</p>
  
  <pre><code>&gt;&gt;&gt; import os
  &gt;&gt;&gt; os.mkdir('foo')
  &gt;&gt;&gt; os.mkdir('foo')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  OSError: [Errno 17] File exists: 'foo'
  </code></pre>
  
  <p>Now I can catch that error like this:</p>
  
  <pre><code>&gt;&gt;&gt; import os
  &gt;&gt;&gt; os.mkdir('foo')
  &gt;&gt;&gt; try:
  ...     os.mkdir('foo')
  ... except OSError, e:
  ...     print e.args
  ... 
  (17, 'File exists')
  </code></pre>
  
  <p>Is there a cross-platform way that I can know that that the 17 or the 'File Exists' will always mean the same thing so that I can act differently depending on the situation?</p>
  
  <p>(This came up <a href="https://stackoverflow.com/questions/273192/python-best-way-to-create-directory-if-it-doesnt-exist-for-file-write">during another question</a>.)</p>