What is the best way to find out the user that a python process is running under?

I could do this:

name = os.popen('whoami').read() 

But that has to start a whole new process.

os.environ["USER"]

works sometimes, but sometimes that environment variable isn't set.

Edit
Report