From 2ce4525830438d60577040dbffc97ea357569200 Mon Sep 17 00:00:00 2001 From: Gilles DAVID Date: Thu, 3 Jun 2021 16:26:15 +0200 Subject: [PATCH] getUserName now uses the standard getpass module --- bin/salome_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 114793af0..346db515a 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -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 # --- -- 2.39.2