[Tutor] pwd lib probs

John Fouhy john at fouhy.net
Tue Aug 19 00:10:37 CEST 2008


2008/8/19 dave selby <dave6502 at googlemail.com>:
> Hi all,
>
> I am using the pwd lib where I am codeing things like ...
>
> gid = pwd.getpwnam(apache2_user)[3]
>
> where as I would like to code it as ...
>
> gid = pwd.getpwnam(apache2_user)[pwd.pw_gid]
>
> but I get
>
> gid = pwd.getpwnam(apache2_user)[pwd.pw_gid]
> AttributeError: 'module' object has no attribute 'pw_gid'
> dave at dev-system:~/kmotion2$ sudo ./install.py
>
> What am I missing ?

I haven't used the pwd module, but at a guess, maybe you should type:

gid = pwd.getpwnam(apache2_user).pw_gid

-- 
John.


More information about the Tutor mailing list