On a simple directory creation operation for example, I can make an OSError like this:
(Ubuntu Linux)
>>> import os
>>> os.mkdir('foo')
>>> os.mkdir('foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 17] File exists: 'foo'
Now I can catch that error like this:
>>> import os
>>> os.mkdir('foo')
>>> try:
... os.mkdir('foo')
... except OSError, e:
... print e.args
...
(17, 'File exists')
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?
(This came up during another question.)