View Single Post
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#7
Originally Posted by juise- View Post
In a hurry, are you?

First of all, to change permissions on file owned by root, your code needs to be root.

Second, the methods you are looking for are os.chown() (for changing owner, if you need to) and os.chmod() (for changing permissions). The library reference is your friend:
http://docs.python.org/library/os.html

So, to change the permission:
Code:
import os
import stat

os.chmod('/your/file', stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
(See the documentation of stat module for more info about the flags)
Yes was a bit hurry, I'm testing my little plugin. And hoping to release it very soon to accomidating people who has the problem with their FM Transmitter.

By the way how do i be as root on my python script?