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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'python.': 0.04; 'cpython': 0.05; 'exceptions': 0.09; '4:59': 0.16; 'received:209.85.213.174': 0.16; 'received:mail-yx0-f174.google.com': 0.16; 'wrote:': 0.18; 'programming': 0.20; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'url:dev': 0.23; 'windows': 0.26; 'pm,': 0.29; 'fairly': 0.30; 'url:library': 0.31; 'message-id:@gmail.com': 0.31; 'wanting': 0.32; 'does': 0.32; 'there': 0.33; 'this.': 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.35; 'url:python': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:192': 0.38; 'somewhat': 0.38; 'think': 0.38; 'received:192.168.1': 0.39; 'url:org': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'url:3': 0.67; 'subject:Change': 0.67; 'subject:handle': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=EVhexR3DTxdk9+tSfIYWil1eO2bYljtYUr9KBCtieEg=; b=aVMAiLSdnm/R7+L1Awj72fVQcS3Xg7k6TvPlc1dVuJJi7NniWgp7YhbRv/R616wMTR 5N4ha10Lk0OqoN/nBHiwFePIOMj7PdFqj03CpVfuaxCBcw461rsIUDuiQRrDtpepy0ah VNWIwDonmXtctGovBCH+0V6wyjiFQcgKqhtLA=
Date Mon, 13 Feb 2012 17:19:21 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111220 Thunderbird/9.0
MIME-Version 1.0
To "comp.lang.python" <python-list@python.org>
Subject Re: Change os.makedirs to handle existing directory
References <2d67ab5b-1916-4f45-b920-476d8cd19c1e@tj4g2000pbc.googlegroups.com>
In-Reply-To <2d67ab5b-1916-4f45-b920-476d8cd19c1e@tj4g2000pbc.googlegroups.com>
X-Enigmail-Version 1.3.5
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5786.1329175174.27778.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329175174 news.xs4all.nl 6984 [2001:888:2000:d::a6]:37651
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20380

Show key headers only | 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