Getting Password from User

Matthew Schinckel matt at null.net
Mon Jun 19 21:46:15 EDT 2000


on 2000-06-18 15:49, Tom Santos (tomsantos at email.com) wrote:
> I'm trying to get a username and password from a user so that I can
> create an FTP connection. I'm using raw_input() to get the username
> but it's not acceptable to get their password. If I use raw_input() to
> get the password, the user's password is echoed to the screen. Is
> there any way to make it so that their password is not shown entirely,
> or characters like '*' are displayed instead of the characters in
> their password?

David Goodger <dgoodger at bigfoot.com> wrote:
> Use module getpass:
> 
> import getpass password = getpass.getpass()
> 
> If you still see the password echoed to the screen, then you're
> missing some functionality, probably termios. Check out the getpass.py
> code for the decision tree that is followed.

Hmm. I tried this under BeOS (python 1.5.2), termios is installed (as
termios.so, a shared lib), and password was echoed back.

Does this sound like a bug in my termios lib?

Matt.



More information about the Python-list mailing list