]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
getUserName now uses the standard getpass module
authorGilles DAVID <gilles-g.david@edf.fr>
Thu, 3 Jun 2021 14:26:15 +0000 (16:26 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Fri, 21 Jan 2022 09:24:13 +0000 (10:24 +0100)
bin/salome_utils.py

index 114793af0a476801849fb2e91fc588c24d8a455c..346db515ac7948fe4706e8ec5382752b72624d0b 100644 (file)
@@ -116,8 +116,14 @@ def getUserName():
 
     :return user name
     """
-    return os.getenv('USERNAME', 'unknown') if sys.platform == 'win32' \
-        else os.getenv('USER', os.getenv('LOGNAME', 'unknown'))
+    if sys.platform == 'win32':
+        username = os.getenv('USERNAME')
+    else:
+        username = os.getenv('USER', os.getenv('LOGNAME'))
+    if username is None:
+        import getpass
+        username = getpass.getuser()
+    return username
 
 # ---