Changing File Permissions

Peter Hansen peter at
Fri Jun 13 20:14:06 CEST 2003

Justin Johnson wrote:
> I'm trying to remove a file on a win2k box, but the readonly bit is set,
> so I get an exception trying to os.remove it.  I'd prefer if I didn't
> have to run an attrib -r command, and write something a little more
> platform independent.  Is there some sort of chmod method that would
> handle this?

>>> import os
>>> print os.chmod.__doc__
chmod(path, mode) -> None
Change the access permissions of a file.


More information about the Python-list mailing list