Re: User Identification

2005-02-09 Thread Bob Parnes
On Tue, 08 Feb 2005 12:29:48 -, Bob Parnes <[EMAIL PROTECTED]> wrote: > I have a python program on a server of an all-linux network. It needs to > record the user name running it. Is there a way for the program to extract > the name from the system without a separate log-in dialog? > > Bob Pa

Re: User Identification

2005-02-08 Thread Michael Ströder
Gerhard Haering wrote: os.getuid() will give you the user id, but I don't know if Python has methods to look up more information from that from /etc/passwd or whereever from. >>> import pwd,os >>> pwd.getpwuid(os.getuid()) ('michael', 'x', 1234, 100, 'Michael Str\xf6der', '/home/michael', '/bin/ba

Re: User Identification

2005-02-08 Thread Gerhard Haering
On Tue, Feb 08, 2005 at 12:29:48PM -, Bob Parnes wrote: > I have a python program on a server of an all-linux network. It needs to > record the user name running it. Is there a way for the program to extract > the name from the system without a separate log-in dialog? os.environ["USER"] for a

Re: User Identification

2005-02-08 Thread Laszlo Zsolt Nagy
how about: import getpass getpass.getuser() 'gromit' Hmm, yours is better. It also works on Windows. :-) I wonder why os.getuser() does not work in Windows - apparently there is a good implementation for Windows. -- _

Re: User Identification

2005-02-08 Thread Laszlo Zsolt Nagy
Bob Parnes wrote: I have a python program on a server of an all-linux network. It needs to record the user name running it. Is there a way for the program to extract the name from the system without a separate log-in dialog? Bob Parnes What about: import os username = os.getlogin() Please see

Re: User Identification

2005-02-08 Thread Fredrik Lundh
Bob Parnes wrote: >I have a python program on a server of an all-linux network. It needs to > record the user name running it. Is there a way for the program to extract > the name from the system without a separate log-in dialog? how about: >>> import getpass >>> getpass.getuser() 'gromit'

User Identification

2005-02-08 Thread Bob Parnes
I have a python program on a server of an all-linux network. It needs to record the user name running it. Is there a way for the program to extract the name from the system without a separate log-in dialog? Bob Parnes -- Bob Parnes [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/p