The code is:
from nntplib import NNTP
s = NNTP('news.gmane.org')
resp, count, first, last, name = s.group('gmane.comp.python.committers')
print 'Group', name, 'has', count, 'articles, range', first, 'to', last
resp, subs = s.xhdr('subject', first + '-' + last)
for id, sub in subs[-10:]:
print id, sub
s.quit()
When I write it into a script, it can execute normally. However, when I input
it in interpreter line by line, I got the follow error when I execute the third
sentence. What's the matter?
>>> 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 "D:\Python27\lib\nntplib.py", line 345, in group
resp = self.shortcmd('GROUP ' + name)
File "D:\Python27\lib\nntplib.py", line 259, in shortcmd
return self.getresp()
File "D:\Python27\lib\nntplib.py", line 214, in getresp
resp = self.getline()
File "D:\Python27\lib\nntplib.py", line 206, in getline
if not line: raise EOFError
EOFError
daedae11
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor