连接到 nntp 服务器时出现 Python 错误
Traceback (most recent call last):
File "<pyshell#27>", line 1, in <module>
server = NNTP('http://www.news.readfreenews.net')
File "C:\Python27\lib\nntplib.py", line 112, in __init__
self.sock = socket.create_connection((host, port))
File "C:\Python27\lib\socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 11001] getaddrinfo failed
>>>
你能帮忙吗
Traceback (most recent call last):
File "<pyshell#27>", line 1, in <module>
server = NNTP('http://www.news.readfreenews.net')
File "C:\Python27\lib\nntplib.py", line 112, in __init__
self.sock = socket.create_connection((host, port))
File "C:\Python27\lib\socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 11001] getaddrinfo failed
>>>
Can you Please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用 HTTP 连接到 NNTP?将
server = NNTP('http://www.news.readfreenews.net')
替换为server = NNTP('news.readfreenews.net')
或server = NNTP('www.news.readfreenews.net')
,具体取决于哪个工作正常。You're using HTTP to connect to NNTP? Replace
server = NNTP('http://www.news.readfreenews.net')
withserver = NNTP('news.readfreenews.net')
orserver = NNTP('www.news.readfreenews.net')
, depending on which works fine.