Author paul.moore
Recipients ivan.radic, paul.moore, r.david.murray, tim.golden, zach.ware
Date 2014-01-21.15:29:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390318184.98.0.281913775098.issue19643@psf.upfronthosting.co.za>
In-reply-to
Content
It's similar. But the problem is that it only returns a list of errors, it doesn't let you address the error *while the rmtree is in progress*.

The key thing is that if you can fix the problem in onerror, you can avoid needing to restart the whole tree walk, which is the key aspect of rmtree.

As things stand, you can use the set_rw function I showed above, and run the rmtree twice:

    shutil.rmtree('path', onerror=set_rw)
    shutil.rmtree('path')

The first run fixes the error and then the second one deletes the remaining files. But this is clearly inefficient, and makes the limitations of "report errors to the user who can then address them" fairly obvious.
History
Date User Action Args
2014-01-21 15:29:45paul.mooresetrecipients: + paul.moore, tim.golden, r.david.murray, zach.ware, ivan.radic
2014-01-21 15:29:44paul.mooresetmessageid: <1390318184.98.0.281913775098.issue19643@psf.upfronthosting.co.za>
2014-01-21 15:29:44paul.moorelinkissue19643 messages
2014-01-21 15:29:44paul.moorecreate