diff -r 0b936ff1bbb9 -r a2bc06a54d9d src/eric7/DebugClients/Python/getpass.py --- a/src/eric7/DebugClients/Python/getpass.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/DebugClients/Python/getpass.py Mon Nov 07 17:19:58 2022 +0100 @@ -13,6 +13,13 @@ is to provide a debugger compatible variant of the a.m. functions. """ +import os + +try: + import pwd +except ImportError: + pwd = None + __all__ = ["getpass", "getuser"] @@ -28,17 +35,16 @@ """ # this is copied from the original getpass.py - import os - for name in ("LOGNAME", "USER", "LNAME", "USERNAME"): user = os.environ.get(name) if user: return user # If this fails, the exception will "explain" why - import pwd + if pwd: + return pwd.getpwuid(os.getuid())[0] - return pwd.getpwuid(os.getuid())[0] + return "<unknown" def getpass(prompt="Password: ", stream=None):