faqts : Computers : Programming : Languages : Python : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 11 people (100%) answered Yes
Recently 4 of 4 people (100%) answered Yes

Entry

I'm trying to get a user's username and password but by using raw_input() the password is echoed to the screen. How can I make it so that their password isn't shown?

Jun 20th, 2000 05:36
unknown unknown, Janko Hauser, David Goodger


Look for the module getpass in the library reference. It also supports
windows according to the document string.

    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.