confusing error with nntplib
Alf P. Steinbach
alfps at start.no
Thu May 27 06:43:17 EDT 2010
* Eduardo Alvarez, on 27.05.2010 03:01:
> 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
This sounds like a time-out.
> 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
When you say "running this", do you mean running a Python program a second time,
or issuing the same command in the interpreter a second time?
For the latter the result would be more or less expected.
After all, you've had an End of File on the connection.
> 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.
Check if there's any way to specify time-outs.
Check if there's any way to trace the actual commands and responses.
Cheers & hth.,
- Alf
--
blog at <url: http://alfps.wordpress.com>
More information about the Python-list
mailing list