From ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 21 Sep 1998 20:00:35 +0000 Subject: When sys.stdin.fileno() doesn't work, fall back to default_getpass() -- don't just die. --- Lib/getpass.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/getpass.py b/Lib/getpass.py index be7a2f9..f0aea63 100644 --- a/Lib/getpass.py +++ b/Lib/getpass.py @@ -29,7 +29,10 @@ def getpass(prompt='Password: '): else: return win_getpass(prompt) - fd = sys.stdin.fileno() + try: + fd = sys.stdin.fileno() + except: + return default_getpass(prompt) old = termios.tcgetattr(fd) # a copy to save new = old[:] -- cgit v0.12