Paul Sigonoso Paul Sigonoso - 3 months ago 28
Python Question

"GetPassWarning: Can not control echo on the terminal" when running from IDLE

When I run this code:

import getpass

p = getpass.getpass(prompt='digite a senha\n')
if p == '12345':
print('YO Paul')
else:
print('BRHHH')
print('O seu input foi:', p) # p = seu input


I got this warning:

Warning (from warnings module):
File "/usr/lib/python3.4/getpass.py", line 63
passwd = fallback_getpass(prompt, stream)
GetPassWarning: Can not control echo on the terminal. Warning: Password input may be echoed.

Answer

Use an actual terminal -- that is, an environment where stdin, stdout and stderr are connected to /dev/tty, or another PTY-compliant device.

The IDLE REPL does not meet this requirement.

Comments