why does getpass() show the input?

J

John Salerno

I'm guessing this might have something to do with my particular system?
Warning: Problem with getpass. Passwords may be echoed.
Password: hello
'hello'
 
J

John Machin

John said:
I'm guessing this might have something to do with my particular system?

Is that meant to be a statement or a question?

If it's a question, and you'd like a helpful answer, try telling us at
least (1) what platform you are running on, (2) did you enter that at
the usual OS command line (with/without readline), or in an IDE (e.g
IDLE) or some other shell (e.g. IPython) (3) version numbers of Python
and any other relevant software (4) Is the question idle curiosity or
do you need a fix real soon now (5) have you been molesting your
console with e.g. stty ...
 
J

John Machin

John said:
If it's a question, and you'd like a helpful answer, try telling us at
least
[snip]

plus (6) what conclusions you have after reading
<your_Python_installation_directory>/Lib/getpass.py
 
R

Robin Haswell

rob@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..... # 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. Let me demonstrate:
.... Password:
'This is a password'.... #
.... # -Rob
....
 
J

John Machin

Robin said:
rob@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.... # 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"
 
R

Robin Haswell

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



You're right, my bad. It's still first thing in the morning here :'(

-Rob
 
J

John Salerno

John said:
Is that meant to be a statement or a question?

Heh heh, sorry! I guess both. Let me clarify:
(1) what platform you are running on,
WinXP

(2) did you enter that at
the usual OS command line (with/without readline), or in an IDE (e.g
IDLE) or some other shell (e.g. IPython)
IDLE

(3) version numbers of Python
and any other relevant software

2.4.3 and nothing else special is running
(4) Is the question idle curiosity

yes, most of my questions are :)
(5) have you been molesting your
console with e.g. stty ...

nope, none of that stuff
(6) what conclusions you have after reading
<your_Python_installation_directory>/Lib/getpass.py

if sys.stdin is not sys.__stdin__:
return default_getpass(prompt)

Ah ha! So it only works at the command prompt, unless I change
__stdin__? Thanks for teaching me a lesson!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top