Change os.makedirs to handle existing directory

Tim Delaney timothy.c.delaney at gmail.com
Tue Feb 14 00:18:58 CET 2012


On 14 February 2012 09:59, Wanderer <wanderer at dialup4less.com> wrote:

> I think wanting to create a directory if one doesn't exist or do
> nothing if it does exist and just use the existing directory is a
> fairly normal programming need. Apparently this is somewhat
> complicated in Python.
> ...
> IMHO, os.makedirs should do this for you with something like
>
> os.makedirs(dirName, exist = False)
>
> and have makedirs silence the error the 'right' way whatever that is,
> without turning it into an exercise for the user.


Added in 3.2:
http://docs.python.org/py3k/library/os.html?highlight=makedirs#os.makedirs

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120214/1684b84a/attachment.html>


More information about the Python-list mailing list