When I use first example in Python's nntplib
module documentation, there are some errors.
>>> from nntplib import NNTP
>>> s = NNTP('news.gmane.org')
>>> resp, count, first, last, name = s.group('gmane.comp.python.committers')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\nntplib.py", line 354, in group
resp = self.shortcmd('GROUP ' + name)
File "C:\Python27\lib\nntplib.py", line 268, in shortcmd
return self.getresp()
File "C:\Python27\lib\nntplib.py", line 223, in getresp
resp = self.getline()
File "C:\Python27\lib\nntplib.py", line 215, in getline
if not line: raise EOFError
EOFError
Why does this happen?
Try s = NNTP('news.gmane.org', readermode=True)
As mentioned in the docs:
If the optional flag
readermode
is true, then amode reader
command is sent before authentication is performed. Reader mode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call reader-specific commands, such asgroup
. If you get unexpected NNTPPermanentErrors, you might need to set readermode.