Hi,

I now think my previous post:

-        debfullname = pwd.getpwnam(os.getlogin())[4].split(',')[0]
+        debfullname = pwd.getpwnam(os.getuid())[4].split(',')[0]

This was buggy.

>>> pwd.getpwnam(os.getuid())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be str, not int

Andrew's solution uses [0]=pw_name to get [4]=pw_gecos.
> pwd.getpwnam(pwd.getpwuid(os.getuid())[0])[4].split(',')[0]

>>> pwd.getpwuid(os.getuid())
pwd.struct_passwd(pw_name='osamu', pw_passwd='x', pw_uid=1000, pw_gid=1000, 
pw_gecos='Osamu Aoki,,,', pw_dir='/home/osamu', pw_shell='/bin/bash')

So why not use: pwd.getpwiud(os.getuid())[4]

-        debfullname = pwd.getpwnam(os.getlogin())[4].split(',')[0]
+        debfullname = pwd.getpwuid(os.getuid())[4].split(',')[0]

Osamu


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to