Python getpass.getpass()函数调用挂起 [英] Python getpass.getpass() function call hangs

查看:212
本文介绍了Python getpass.getpass()函数调用挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图得到一个提示,要求您输入密码,但是当我尝试呼叫getpass.getpass()时,它只是冻结了.我在Canopy上使用Python 2.7在Windows 7 64位上运行.

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 Python 2.7 on Canopy.

import sys
import getpass

p = getpass.getpass()
print p

推荐答案

Python有效冻结,因为它无法接收来自标准输入的输入".参见 https://support.enthought.com/entries/22157050-Canopy-Python-prompt-QtConsole-Can-t-run-getpass-or-interactive-OS-shell-commands-or- Windows进程

Python "effectively freezes because it can't receive the input from standard input". See https://support.enthought.com/entries/22157050-Canopy-Python-prompt-QtConsole-Can-t-run-getpass-or-interactive-OS-shell-commands-or-Windows-process

解决方法是使用其他解释器.我改用IDLE并解决了该问题.

The fix is to use a different interpreter. I switched to IDLE and fixed the issue.

这篇关于Python getpass.getpass()函数调用挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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