2015-05-14 159 views
0

當我鍵入隱藏密碼()

>>> passwd = getpass.getpass() 

到Python 2.7的外殼,在空閒時,我得到的結果:

Warning (from warnings module): 
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/getpass.py", line 55 
    passwd = fallback_getpass(prompt, stream) 
GetPassWarning: Can not control echo on the terminal. 
Warning: Password input may be echoed. 
Password: 

然後當我鍵入密碼,它並不隱藏。我需要將它發送給一個變量,所以我可以使用sha模塊對其進行SHA處理,並與'SHAed'原始數據進行比較。

+1

你運行它在閒置? http://stackoverflow.com/questions/21264701/getpass-getpass-error-without-other-code – Dair

+0

另外,pass是一個關鍵字。 – Dair

回答

1

pass是一個python關鍵字。請更改類似

password = getpass.getpass() 

然後從shell中運行它/控制檯

+0

謝謝。有效。 –