getPass() echoing password in Eclipse

限于喜欢 提交于 2019-12-10 14:35:36

问题


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.

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()

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?


回答1:


This is documented behaviour - some terminals are not capable of echo-free input, in that case, it should give a warning instead:

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.

From the docs for getpass.getpass().



来源:https://stackoverflow.com/questions/15668607/getpass-echoing-password-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!