On Fri, Sep 23, 2016 at 2:16 AM, Andrew Clark <ryaku...@gmail.com> wrote:
> I'm looking for a way to either completely hide character as you type in 
> command line or add ***** to each character as you for simple password 
> obscurity. I've tried getpass.getpass() however the characters still show up 
> on the screen as you type it. Can anyone help? I'm using python 2.7 on 
> windows.
> host = 'ldxnis12.dx.deere.com'
>     username = raw_input("Enter username: ")
>     password = raw_input("Enter password: ")
> Output:
> Enter username: username
> Enter password: iwanthistonotshowup

Sounds like a limitation or bug in getpass. I don't have 2.7 handy,
but just tried it on Win 7, CPython 3.5, and it correctly hid the
characters. (Granted, a lot of Windows users are surprised by the lack
of asterisks. But it's still better than leaving it visible.) It
doesn't hide the password in Idle (and gives a warning to that
effect), but if you're working in a GUI, you have other options

Try upgrading to 3.5 and see if you can make it work there. If not,
gather a ton of details about your system, and raise the issue - what
you want is exactly what getpass should provide.


Reply via email to