[Python-Dev] mkdir -p in python

Clinton Roy clinton.roy at gmail.com
Wed Jul 21 10:11:44 CEST 2010


Hey folks,

On 21 July 2010 10:37, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Steven D'Aprano wrote:
>>
>> Perhaps all we need is a recipe in the docs:
>>
>> try:
>>    os.makedirs(path)
>> except OSError, e:
>>    if e.errno != 17:
>>        raise
>
> I don't like writing code that depends on particular
> errno values, because I don't trust it to work cross-
> platform.

I use errno.EEXIST instead of a magic number.

later,
-- 
Clinton Roy
Software Engineer
Global Change Institute
University of Queensland

humbug.org.au  - Brisbane Unix Group
clintonroy.wordpress.com - Blog
flickr.com/photos/croy/ - Photos


More information about the Python-Dev mailing list