From: Gilles DAVID Date: Thu, 3 Jun 2021 14:26:15 +0000 (+0200) Subject: getUserName now uses the standard getpass module X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2ce4525830438d60577040dbffc97ea357569200;p=modules%2Fkernel.git getUserName now uses the standard getpass module --- 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 # ---