Replaced os.getlogin() by getpass.getuser().

Sun, 25 Oct 2020 14:34:57 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 25 Oct 2020 14:34:57 +0100
changeset 7814
6fa40642ed7c
parent 7813
5d0dbec7b815
child 7815
f71353be115f

Replaced os.getlogin() by getpass.getuser().

eric6/UI/UserInterface.py file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
--- a/eric6/UI/UserInterface.py	Sun Oct 25 12:28:07 2020 +0100
+++ b/eric6/UI/UserInterface.py	Sun Oct 25 14:34:57 2020 +0100
@@ -13,6 +13,7 @@
 import shutil
 import json
 import datetime
+import getpass
 
 from PyQt5.QtCore import (
     pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate,
@@ -1490,7 +1491,7 @@
                                 os.path.expanduser("~"))
                         )
                         if installInfo["virtualenv"]:
-                            installInfo["user"] = os.getlogin()
+                            installInfo["user"] = getpass.getuser()
                             installInfo["exe"] = sys.executable
                         installInfo["installed"] = True
                         installInfo["installed_on"] = installDateTime.strftime(
--- a/scripts/install.py	Sun Oct 25 12:28:07 2020 +0100
+++ b/scripts/install.py	Sun Oct 25 14:34:57 2020 +0100
@@ -23,6 +23,7 @@
 import json
 import shlex
 import datetime
+import getpass
 
 # Define the globals.
 progName = None
@@ -1315,7 +1316,7 @@
         installInfo["sudo"] = os.getuid() == 0
     except AttributeError:
         installInfo["sudo"] = False
-    installInfo["user"] = os.getlogin()
+    installInfo["user"] = getpass.getuser()
     installInfo["exe"] = sys.executable
     installInfo["argv"] = " ".join(shlex.quote(a) for a in sys.argv[:])
     installInfo["install_cwd"] = installCwd

eric ide

mercurial