On 10/12/11 02:44:48, Tim Chase wrote:
Currently I can get the currently-logged-in-userid via getpass.getuser()
which would yield something like "tchase".

Is there a cross-platform way to get the full username (such as from the
GECOS field of /etc/passed or via something like NetUserGetInfo on Win32
so I'd get "Tim Chase" instead?

How about:

    pwd.getpwuid(os.getuid()).pw_gecos

This will give you the GECOS field of /etc/passed.
I'd assume it contains "Tim Chase" for your account.

Hope this helps,

-- HansM

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to