[Python-Dev] mkdir -p in python (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jul 21 02:37:20 CEST 2010
- Previous message: [Python-Dev] mkdir -p in python
- Next message: [Python-Dev] mkdir -p in python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Also it seems suboptimal to require people to use a recipe like this to get the behaviour that is wanted in the overwhelming majority of cases.
I don't see what would be so bad about adding a new function for this. Think of it as correcting the mistake of not making makedirs() behave this way from the beginning.
-- Greg
- Previous message: [Python-Dev] mkdir -p in python
- Next message: [Python-Dev] mkdir -p in python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]