Mod by Jack Jansen: on Macintosh, use EasyDialogs.GetPassword if it

exists.
This commit is contained in:
Guido van Rossum 1999-02-11 14:41:46 +00:00
parent a598bc412c
commit c731723730
1 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,8 @@ def getpass(prompt='Password: '):
On Windows, this calls win_getpass(prompt) which uses the
msvcrt module to get the same effect.
On the Mac EasyDialogs.AskPassword is used, if available.
"""
@ -29,7 +31,12 @@ def getpass(prompt='Password: '):
try:
import msvcrt
except ImportError:
return default_getpass(prompt)
try:
from EasyDialogs import AskPassword
except ImportError:
return default_getpass(prompt)
else:
return AskPassword(prompt)
else:
return win_getpass(prompt)