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


Groups > comp.lang.python > #107506

Re: Remove directory tree without following symlinks

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From eryk sun <eryksun@gmail.com>
Newsgroups comp.lang.python
Subject Re: Remove directory tree without following symlinks
Date Fri, 22 Apr 2016 13:28:01 -0500
Lines 10
Message-ID <mailman.3.1461349723.32212.python-list@python.org> (permalink)
References <571a3ba2$0$1597$c3e8da3$5496439d@news.astraweb.com> <1461337766.365000.586700849.0DDBDB0B@webmail.messagingengine.com> <mailman.16.1461337768.2861.python-list@python.org> <571a5be6$0$1590$c3e8da3$5496439d@news.astraweb.com> <DUB123-W22A605538041FB2749C64B836F0@phx.gbl> <CACL+1aueH_scSTYW1Q6pGsZ92+8OWHB6tks3SqAAaU-wb6Ac4Q@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de zbwMvHuQI6TOs7Wlca0PiQMWdELJIEvnXvdzClxOu8RA==
Return-Path <eryksun@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'handler': 0.04; 'raises': 0.07; '22,': 0.09; 'raised,': 0.09; 'url:github': 0.09; 'windowserror': 0.09; '2016': 0.16; 'fyi,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Remove': 0.16; 'url:pip': 0.16; 'wrote:': 0.16; '(or': 0.23; 'help.': 0.23; 'header:In- Reply-To:1': 0.24; 'error': 0.27; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'sure,': 0.29; 'option': 0.31; 'received:google.com': 0.35; 'dir': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; "won't": 0.38; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'today': 0.65; 'improvement.': 0.66; 'subject:tree': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=L9bv/HqQjAsT2tJSsXKc2/ZV//Pmf7Iu6X2/WnoRhUI=; b=k3/aelBy/Q5FIYJJf/B6Hz1dViI4vJ38hpskZQjbClUOVbEH67qxpk5ltI/9lUIDNb mq+zCfaVobpb2zn8QgKPA2twE/SpVBYi6iN1z8sKRsmxeLubWChzqJdSrtYj48yIkXzf VtojP2u6g2j1OCDttkxprDry6CoSXnTWhwyL97Jkzjt+2fC20hdQjFma5z/cduaobO7S Qy0VoHjx/1KuENw7YJtS0pxJ/o6BUTKq8iccpvuDt/Sw0UAskMY28qFJ/ORT5YRtNaLd ZPrMzewO+mlZR7oJ5nTeR/uKPADjBjmazDa80v0PP3ZYQdHa1TkvW1kQCRk65IL/WPn8 v3gQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=L9bv/HqQjAsT2tJSsXKc2/ZV//Pmf7Iu6X2/WnoRhUI=; b=cQIG6RKLTBRqA+pODuORO4ayOiZJCjlm233jaC8eWDusKEhSrU4hba17i+hIrAp6Nr 3nvJtuFrrA0of50xL99b/c/XvFxMeszeo3ToxBlURQLRIkYj03WMDgzz9j9WpU4p0ZbA u6WXzmIOws9zSpPIZOULaKqzakpyq3XjNLo7GjYdBg87+6KpgORceoQY++NkanpuO1bx oRaQHZY5jjkgZXU5gDujTxKUbc2M2hBpbdxUz+OSypSoRagx4akWHSR9vNV5/c1zplJd GIe4hLKyRM3FxDQdKSh4ogolajJYggBDiNYonj9xEAdi6ND1wRcd7ln1mPoOJ3nwS7vl Yv3w==
X-Gm-Message-State AOPr4FXWHpjfW7M5lC4wylivXQOoi7PJ13aVqFzKPFmCmLB5A3IdLFIVI7TNpN97I8Flp6vyALTDDjOJGO9KSQ==
X-Received by 10.50.227.131 with SMTP id sa3mr6192486igc.55.1461349721165; Fri, 22 Apr 2016 11:28:41 -0700 (PDT)
In-Reply-To <DUB123-W22A605538041FB2749C64B836F0@phx.gbl>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CACL+1aueH_scSTYW1Q6pGsZ92+8OWHB6tks3SqAAaU-wb6Ac4Q@mail.gmail.com>
X-Mailman-Original-References <571a3ba2$0$1597$c3e8da3$5496439d@news.astraweb.com> <1461337766.365000.586700849.0DDBDB0B@webmail.messagingengine.com> <mailman.16.1461337768.2861.python-list@python.org> <571a5be6$0$1590$c3e8da3$5496439d@news.astraweb.com> <DUB123-W22A605538041FB2749C64B836F0@phx.gbl>
Xref csiph.com comp.lang.python:107506

Show key headers only | View raw


On Fri, Apr 22, 2016 at 12:39 PM, Albert-Jan Roskam
<sjeik_appie@hotmail.com> wrote:
> FYI, Just today I found out that shutil.rmtree raises a WindowsError if the dir is read-
> only (or its contents). Using 'ignore_errors', won't help. Sure, no error is raised, but the
> dir is not deleted either! A 'force' option would be a nice improvement.

Use the onerror handler to call os.chmod(path, stat.S_IWRITE). For
example, see pip's rmtree_errorhandler:

https://github.com/pypa/pip/blob/8.1.1/pip/utils/__init__.py#L105

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


Thread

Remove directory tree without following symlinks Steven D'Aprano <steve@pearwood.info> - 2016-04-23 00:56 +1000
  Re: Remove directory tree without following symlinks Random832 <random832@fastmail.com> - 2016-04-22 11:09 -0400
    Re: Remove directory tree without following symlinks Steven D'Aprano <steve@pearwood.info> - 2016-04-23 03:14 +1000
      RE: Remove directory tree without following symlinks Albert-Jan Roskam <sjeik_appie@hotmail.com> - 2016-04-22 17:39 +0000
      Re: Remove directory tree without following symlinks eryk sun <eryksun@gmail.com> - 2016-04-22 13:28 -0500
      RE: Remove directory tree without following symlinks Albert-Jan Roskam <sjeik_appie@hotmail.com> - 2016-04-23 09:34 +0000
      Re: Remove directory tree without following symlinks eryk sun <eryksun@gmail.com> - 2016-04-23 15:22 -0500
      Re: Remove directory tree without following symlinks eryk sun <eryksun@gmail.com> - 2016-04-24 14:42 -0500
  Re: Remove directory tree without following symlinks Paul Rubin <no.email@nospam.invalid> - 2016-04-23 01:13 -0700
    Re: Remove directory tree without following symlinks Steven D'Aprano <steve@pearwood.info> - 2016-04-23 20:24 +1000
      Re: Remove directory tree without following symlinks Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-04-23 23:37 +1200
      Re: Remove directory tree without following symlinks Random832 <random832@fastmail.com> - 2016-04-23 17:04 -0400
  Re: Remove directory tree without following symlinks Nobody <nobody@nowhere.invalid> - 2016-04-23 17:29 +0100
    Re: Remove directory tree without following symlinks Random832 <random832@fastmail.com> - 2016-04-23 17:07 -0400

csiph-web