why does getpass() show the input?

John Machin sjmachin at lexicon.net
Thu Aug 10 05:39:02 EDT 2006


Robin Haswell wrote:
> rob at aranea:~$ python
> Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
> [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> >>> # The cause of this problem is because you're using the console
> ... # to test getpass. getpass.getpass()'s return value is the
> ... # password inputted, but because you're not capturing its return
> ... # value, the console is printing it.

Please look again at the OP's post. Here is the relevant part, with my
annotations:

#>>> getpass.getpass()
Warning: Problem with getpass. Passwords may be echoed. <<<=== Ooooh!
What's printing that?
Password: hello <<<<<<<<<====== echoing his input as he typed
'hello' <<<<<<=== what you call "the console is printing it"




More information about the Python-list mailing list