fix when os.getlogin() throws OSError 2 No such file or directory

OSError: [Errno 2] No such file or directory
http://stackoverflow.com/questions/4399617/python-os-getlogin-problem
http://stackoverflow.com/questions/4785126/getlogin-c-function-returns-null-and-error-no-such-file-or-directory