os.remove() permission problem

Victor Subervi victorsubervi at gmail.com
Tue Dec 1 08:41:50 EST 2009


On Tue, Dec 1, 2009 at 8:12 AM, Christian Heimes <lists at cheimes.de> wrote:

> Victor Subervi wrote:
> > Well, that's what I've tried. I've loaded the permissions up, 0777, and
> it
> > still throws the same error. I've also tried os.chmod(file, 0777) from
> the
> > script, and I get the same permissions error. I can do all of this from
> the
> > python prompt. I've set the ownership of the file attempting these
> commands
> > to root.root. Nothing works. Please advise.
>
> You have to set the write and execute permssion on *directory*, not on
> the file. unlink (aka remove) requires write permission on the directory
> in order to remove the file.
>

That worked!

>
> It's like in the real world. You may be allowed to modify a document (w
> permission on the file) but you may not be allowed to remove it from its
> cabinet (w permission on the directory).
>

THANK YOU for this analogy. Hopefully, that will help me remember it the
next time it occurs ;)
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091201/f5068f37/attachment-0001.html>


More information about the Python-list mailing list