gpt4 book ai didi

python - 是什么导致 AppEngine 的 Python 脚本中出现此 imaplib 错误?

转载 作者:太空宇宙 更新时间:2023-11-04 10:58:53 27 4
gpt4 key购买 nike

这个脚本:

    import imaplib

user = "dave.trindall@gmail.com"
pwd = "***"

m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user,pwd)
m.select("Inbox") # here you a can choose a mail box like INBOX instead
m.search("NEW")

为我犯了这个错误:

Traceback (most recent call last):
File "c:\Program Files\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 701, in __call__
handler.get(*groups)
File "c:\Users\Dave\git_stuff\Touch Base\Touch Base\main.py", line 30, in get
m = imaplib.IMAP4_SSL("imap.gmail.com")
File "c:\Python26\lib\imaplib.py", line 1138, in __init__
IMAP4.__init__(self, host, port)
File "c:\Python26\lib\imaplib.py", line 163, in __init__
self.open(host, port)
File "c:\Python26\lib\imaplib.py", line 1149, in open
self.sock = socket.create_connection((host, port))
AttributeError: 'module' object has no attribute 'create_connection'

为什么?

最佳答案

这会失败,因为 App-Engine 不允许在您的应用程序中打开套接字。请参阅 http://code.google.com/appengine/docs/python/runtime.html 中的“纯 Python”部分, 也在 http://groups.google.com/group/google-appengine/browse_thread/thread/4a8764d266ec17af 讨论

关于python - 是什么导致 AppEngine 的 Python 脚本中出现此 imaplib 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7376314/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com