When will os.remove fail?

Steve D'Aprano steve+python at pearwood.info
Sun Mar 12 21:51:01 EDT 2017

On Mon, 13 Mar 2017 05:45 am, Alain Ketterlin wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:
>> It seems that os.remove on Linux will force the delete even if the file
>> is read-only or unreadable, provided you own the file.
> Your permissions on the file do not really matters. It's all about your
> permissions on the parent directory (removing a file is really modifying
> the parent dir). Actually, it is even slightly more complicated. Here is
> an excerpt of the unlink(2) call (which does the job) listing common
> error cases:

Thanks for the detailed explanation, and to everyone else who corrected my

“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

More information about the Python-list mailing list