diff options
Diffstat (limited to 'Lib/getpass.py')
| -rw-r--r-- | Lib/getpass.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/getpass.py b/Lib/getpass.py index 0044742193..ed9bc5901d 100644 --- a/Lib/getpass.py +++ b/Lib/getpass.py @@ -40,6 +40,7 @@ def unix_getpass(prompt='Password: ', stream=None): """ fd = None tty = None + passwd = None try: # Always try reading and writing directly on the tty first. fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) @@ -47,7 +48,7 @@ def unix_getpass(prompt='Password: ', stream=None): input = tty if not stream: stream = tty - except EnvironmentError as e: + except OSError as e: # If that fails, see if stdin can be controlled. try: fd = sys.stdin.fileno() @@ -163,7 +164,7 @@ try: except (ImportError, AttributeError): try: import msvcrt - except ImportError: + except ModuleNotFoundError: getpass = fallback_getpass else: getpass = win_getpass |
