Reputation: 25639
I want to use:
import getpass
password = getpass.getpass("Enter your password:")
print password
On winx64 using python 2.7... The 2nd line hangs. I dont see the dialog. " Enter your password:"
Upvotes: 9
Views: 19659
Reputation: 3284
As the other comments already indicated, you have to run this script within the Power Shell to actually see the "Enter your password:"
text and be able to enter a password.
Upvotes: 2
Reputation: 4357
According to your comment above, you are actually using ipython within spyder. The only issue I came across for getpass in Spyder is at their Google code page. The issues is not exactly the same as yours, but included in the comments is the following code snippet:
def spyder_getpass(prompt='Password: '):
set_spyder_echo(False)
password = raw_input(prompt)
set_spyder_echo(True)
return password
Try using the method above (utilizing raw_input instead of getpass) to get the required password you need.
Upvotes: 3