Eduardo Alvarez wrote:

> 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

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

I tried your example and got the EOFError, too.

>>> import nntplib
>>> s = nntplib.NNTP("nntp.aioe.org")
>>> s.group("comp.lang.python")
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
>>> s = nntplib.NNTP("nntp.aioe.org", readermode=True)
>>> s.group("comp.lang.python")
('211 2445 50405 52863 comp.lang.python', '2445', '50405', '52863', 
'comp.lang.python')

nntplib.NNTP(host, readermode=True) seems to fix the problem (if it wasn't 
sheer luck).

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to