pythonnntp

Python error while connecting to nntp server


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


Solution

  • You're using HTTP to connect to NNTP? Replace server = NNTP('http://www.news.readfreenews.net') with server = NNTP('news.readfreenews.net') or server = NNTP('www.news.readfreenews.net'), depending on which works fine.