From: Guido van Rossum Date: Mon, 21 Sep 1998 20:00:35 +0000 (+0000) Subject: When sys.stdin.fileno() doesn't work, fall back to default_getpass() X-Git-Tag: v1.5.2a2~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef0056ae1a5f6dd2cc10505fb10e7653418d7f1f;p=python When sys.stdin.fileno() doesn't work, fall back to default_getpass() -- don't just die. --- diff --git a/Lib/getpass.py b/Lib/getpass.py index be7a2f9049..f0aea63ac3 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[:]