Chmod to a group only

Peter Otten __peter__ at web.de
Mon Dec 1 15:59:17 EST 2008


Kless wrote:

> On 1 dic, 18:17, Kless <jonas.... at googlemail.com> wrote:
>> How to chmod a file to: o-rwx ? (to change only the others mode)
>>
>> os.chmod(fname, )
>>
>> I was reading this [1], but the truth is that anything as 'S_IRUSR'
>> doesn't help enought.
>>
>> [1]http://www.python.org/doc/2.5.2/lib/os-file-dir.html
> 
> I have tried:
> 
> mode = os.stat(fname).st_mode
> os.chmod(fname, mode | stat.S_IRWXO) => Changes to o+rwx

How did the result of the above differ from what you want? The way I read
your original post something like the above would have been my answer...

Peter



More information about the Python-list mailing list