selfteaching / selfteaching-python-camp

147 stars 880 forks source link

Day11 关于vscode中 input()在Python interactive中运行出错的问题 #2287

Open ZhengGuanya opened 5 years ago

ZhengGuanya commented 5 years ago

使用input()运行时出现错误:StdinNotImplementedError: raw_input was called, but this frontend does not support input requests. 代码如下: import yagmail import getpass sender = input('输入发件人邮箱:') password = getpass.getpass('输入发件人邮箱密码:') recipients = input('输入发件人邮箱:') yag = yagmail.SMTP(sender,password,'smtp.qq.com') contents = str(stats) yag.send(recipients, '19100402 ZhengGuanya', contents) 已尝试input(("输入发件人邮箱:")) 和input("输入发件人邮箱:") 以及input((’输入发件人邮箱:’)) 等均未能运行成功。

pansij123 commented 5 years ago

我试验了 代码可以运行 支持输入邮箱和密码。

输入了假的邮箱和密码,报错提示邮箱密码错误。

并没有与input()有关的错误。

另外recipients = input('输入发件人邮箱:') 应该是 收件人邮箱。

运行环境是 命令行下的 $ python3 ZG.py

ZhengGuanya commented 5 years ago

谢谢回答,我可能没有表述清楚,我在terminal中可以运行,在Python interactive 中出现了中情况,同时,我引用模块时也出现这种情况(可以在termial 中运行,interactive中出现ModuleNotFoundError)google发现可能是我的配置环境有问题,目前还在解决中……(已改为“收件人邮箱:”,谢谢提醒!) @pansij123