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