confusing error with nntplib

Eduardo Alvarez !nospam!astrochelonian at gmail.com
Wed May 26 21:01:06 EDT 2010


When trying to use nntplib to connect to the news server nntp.aioe.org,
a bizarre sequence of events occurs:

1) I import the module, and create an instance, as follows:

s = nntplib.NNTP('nntp.aioe.org')

I get no errors, which leads me to believe all went well. The I try
fetching info on a newsgroup (in this case, comp.lang.python):

s.group('comp.lang.python')

I then get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/nntplib.py", line 345, in group
    resp = self.shortcmd('GROUP ' + name)
  File "/usr/lib/python2.6/nntplib.py", line 259, in shortcmd
    return self.getresp()
  File "/usr/lib/python2.6/nntplib.py", line 214, in getresp
    resp = self.getline()
  File "/usr/lib/python2.6/nntplib.py", line 206, in getline
    if not line: raise EOFError
EOFError

Running this a *second* time, gives me the following, different error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/nntplib.py", line 345, in group
    resp = self.shortcmd('GROUP ' + name)
  File "/usr/lib/python2.6/nntplib.py", line 258, in shortcmd
    self.putcmd(line)
  File "/usr/lib/python2.6/nntplib.py", line 198, in putcmd
    self.putline(line)
  File "/usr/lib/python2.6/nntplib.py", line 193, in putline
    self.sock.sendall(line)
  File "<string>", line 1, in sendall
socket.error: [Errno 32] Broken pipe

As this is a broken pipe, I reconnect to the server, the same way as
before. When I *then* retrieving the newsgroup's info, I get no errors.

I'm pretty baffled by this. It might be an issue with the server itself,
but still, any input would be very appreciated.

yours,

-- 
Eduardo Alvarez

"Stercus, Stercus, Stercus, moriturus sum"
  -- Rincewind The Wizzard



More information about the Python-list mailing list