SyntaxFix
Write A Post
Hire A Developer
Questions
You best bet would be to combine os.getuid() with pwd.getpwuid():
os.getuid()
pwd.getpwuid()
import os import pwd def get_username(): return pwd.getpwuid( os.getuid() )[ 0 ]
Refer to the pwd docs for more details:
http://docs.python.org/library/pwd.html