Utilities/__init__.py

changeset 114
f6e7cec11168
parent 97
c4086afea02b
child 141
c76f1ec28766
--- a/Utilities/__init__.py	Sun Feb 14 11:28:47 2010 +0000
+++ b/Utilities/__init__.py	Sun Feb 14 13:33:03 2010 +0000
@@ -14,6 +14,7 @@
 import glob
 import random
 import base64
+import getpass
 
 import warnings
 warnings.filterwarnings("error", category=SyntaxWarning)
@@ -839,10 +840,10 @@
     
     @return user name (string)
     """
-    if isWindowsPlatform():
+    user = getpass.getuser()
+    
+    if not user and isWindowsPlatform():
         return win32_GetUserName()
-    else:
-        return posix_GetUserName()
 
 def getHomeDir():
     """
@@ -1195,21 +1196,7 @@
 # posix compatibility functions below
 ################################################################################
 
-def posix_GetUserName():
-    """
-    Function to get the user name under Posix systems.
-    
-    @return user name (string)
-    """
-    try:
-        import pwd
-        return pwd.getpwuid(os.getuid())[0]
-    except ImportError:
-        try:
-            u = getEnvironmentEntry('USER')
-        except KeyError:
-            u = getEnvironmentEntry('user', None)
-        return u
+# None right now
 
 ################################################################################
 # win32 compatibility functions below

eric ide

mercurial