> > getlogin() -- returns user's login name > > -- could do something similar with pwd.getpwuid( os.getuid() )[0], but > > getlogin() apparently looks in utmp > > With a documentation proviso that utmp is very old-fashioned, and you > really should do the getuid() thing unless you definitely want to get > the login ID from utmp. Perhaps an alternate "getlogin" (different > name?) that does the getuid() thing could be provided. There's the getpass module which has a getuser() function that looks in various env vars and if all else fails uses getuid() and pwd. If the goal is to get the user ID without being fooled, using os.getuid() or os.geteuid() directly seems to be the right thing to do; I don't see the need for a shorthand for pwd.getpwuid(os.getuid())[0] (which is what getuser() uses). --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4