A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-July/102171.html below:

[Python-Dev] mkdir -p in python

[Python-Dev] mkdir -p in pythonBen Finney ben+python at benfinney.id.au
Thu Jul 22 07:52:45 CEST 2010
Greg Ewing <greg.ewing at 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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4