“GetPassWarning:无法控制终端上的回声";从 IDLE 运行时 [英] "GetPassWarning: Can not control echo on the terminal" when running from IDLE

查看:94
本文介绍了“GetPassWarning:无法控制终端上的回声";从 IDLE 运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行此代码时:

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

我收到此警告:

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.

推荐答案

使用实际的终端——即stdinstdout所在的环境stderr 连接到 /dev/tty 或其他 PTY 兼容设备.

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

IDLE REPL 不满足此要求.

The IDLE REPL does not meet this requirement.

这篇关于“GetPassWarning:无法控制终端上的回声";从 IDLE 运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆