os.chown()
Mike Meyer
mwm at mired.org
Fri Nov 11 18:25:18 EST 2005
James Colannino <james at colannino.org> writes:
> Hey everyone. I tried to use os.chown() in the following manner:
>
> os.chown('filename', 'username', 'groupname')
>
> I got an error, and when I googled for this function I realized that I
> must pass the numerical uid and gid. My question is, is there a way
> for me to change ownership based on the name instead of the number?
> Perhaps there's a function that will let me lookup the uid from the
> username, and the gid from the groupname?
You want pwd.getpwnam and grp.getgrnam.
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list
mailing list