Python getpass.getpass() function call hangs

后端 未结 5 1060
广开言路
广开言路 2021-01-06 01:10

I am trying to get a prompt that will ask for my password but when I try to call getpass.getpass() it just freezes. I am running on Windows 7 64 bit using Pytho

5条回答
  •  灰色年华
    2021-01-06 01:45

    It is correct that Python "effectively freezes because it can't receive the input from standard input", however, for windows you can prefix your command with winpty. Then password can be inputted correctly when started like:

    winpty python fileToExecute.py
    

    winpty provides a interface similar to a Unix pty-master in a way that communication is also possible from windows terminals.

提交回复
热议问题