When will os.remove fail?

Erik python at lucidity.plus.com
Tue Mar 14 17:14:53 EDT 2017


On 14/03/17 13:56, Chris Angelico wrote:
> On Wed, Mar 15, 2017 at 12:30 AM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
>> rm does not ask before deleting. However some Linux distributions
>> take it upon themselves to put "alias rm='rm -i'" in /etc/profile.
>
> I have no such alias, but it still prompts.

[snip]

> This is the GNU coreutils rm command. Obviously behaviour may be
> different with non-GNU rm's.

Yes, I believe this is something extra that particular versions of 'rm' 
may do (over and above the POSIX/unlink() semantics discussed already).

Although one has permission at the OS/filesystem level to unlink the 
file, unless '-f' is specified they may still ask ('-i' behaviour) if 
that file is otherwise not modifiable by the user running the command, 
as a safety net.

E.



More information about the Python-list mailing list