- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Edit Admin
Frist,
As you see in the next snippet, it's an exception handler that's used with
shutil.rmtree, so that's the parameter list it needs.Admin
I'm curious about how and where this code is used
Edit Admin
Possibly it should do something with those parameters, though. The current logic is "if there's an error deleting a file, add write permission, and then delete it again". I don't think that will work anyway - IIRC you need write permission to the directory containing the file, not write permission to the file itself, to delete it. And if the error is due to something other than the file not being writable, deleting it again will still fail.
Edit Admin
In my experience, you need both write permissions (to the file and to the directory that contains the name that you want to delete(1).
(1) That's not a circumlocution. If you want to delete the file, you have to delete all of its hard links.