getPass()在Eclipse中回显密码
嘿,所有这一切刚刚开始在一个Python中玩耍,以帮助在工作中的几个脚本,但是我似乎在一个小问题上挂起了。
Hey all just started dabbling in a little Python to help out with a few scripts at work, but I seem to be getting hung up on a little issue.
我使用Eclipse与pydev作为我的开发平台,并针对python 2.7.3开发。我只是试图提醒用户他们的密码,使用:
I am using Eclipse with pydev for my development platform and developing against python 2.7.3. I am just trying to prompt a user for their password, using:
password = getpass.getpass()
该行在终端/命令提示符下运行时正常工作,但是当我在Eclipse控制台中运行时,用户的输入不是像它应该是隐藏的。任何想法如何解决这个问题?
That line works as expected when running in the terminal/command prompt, however when I am running in the Eclipse console, the user's input isn't hidden like it should be. Any ideas how to fix this?
这是一个记录的行为 - 一些终端不能进行无回波输入,情况下,应该发出警告:
This is documented behaviour - some terminals are not capable of echo-free input, in that case, it should give a warning instead:
如果无回音输入不可用getpass()返回以打印警告消息流,从sys.stdin读取并发出GetPassWarning。
If echo free input is unavailable getpass() falls back to printing a warning message to stream and reading from sys.stdin and issuing a GetPassWarning.