Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20380

Re: Change os.makedirs to handle existing directory

Date 2012-02-13 17:19 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: Change os.makedirs to handle existing directory
References <2d67ab5b-1916-4f45-b920-476d8cd19c1e@tj4g2000pbc.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.5786.1329175174.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 2/13/2012 4:59 PM, Wanderer 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. 
There are new exceptions in 3.3, one of which is for exactly this.

http://docs.python.org/dev/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy
http://docs.python.org/dev/library/exceptions.html#FileExistsError

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Change os.makedirs to handle existing directory Wanderer <wanderer@dialup4less.com> - 2012-02-13 14:59 -0800
  Re: Change os.makedirs to handle existing directory Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-13 17:19 -0600

csiph-web