Greg Ewing <greg.ew...@canterbury.ac.nz> writes:

> Ray Allen wrote:
>
> > I think in this case, the errno is generate by c standard library,
> > which can be seen as cross-platform.
>
> But I'm never sure how standard the actual error numbers are, though.

You can use them by name, and in fact I strongly recommend it:

    import os
    import errno
    try:
        os.makedirs(path)
    except OSError, exc:
        if exc.errno != errno.EEXIST:
            raise

> I tend to think of them as coming from Unix-land, and thus fair game
> for getting screwed around with on Windows. Am I worrying too much?

There are some that differ between different OSen, true. Using them by
name avoids dealing with *different* numbers (since the ‘errno’ module's
attributes will use the same name for semantically the same error),
leaving only the problem of errors that are *missing* on some platforms.
EEXIST is common to all of them though, AFAIK.

-- 
 \     “Sittin' on the fence, that's a dangerous course / You can even |
  `\       catch a bullet from the peace-keeping force” —Dire Straits, |
_o__)                                   _Once Upon A Time In The West_ |
Ben Finney

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to