nntplib.NNTPTemporaryError: 441 Article has no body -- just headers
Jon Bendtsen
noone at example.com
Wed May 27 08:25:58 EDT 2009
Hi
I'm trying to expand cvsmail.py so it posts to newsgroups, but i
constantly get this error message:
nntplib.NNTPTemporaryError: 441 Article has no body -- just headers
If i put the test message into a file then i can post it just fine,
no problems. But if i put the message into a StringIO, then i can
not post messages and i get the above error message. Where is the
problem?
>>> buffer=StringIO()
>>> f = open('/tmp/article')
>>> buffer.write(f.read())
>>> s=nntplib.NNTP('dknntp.laerdal.global')
>>> s.post(buffer)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/nntplib.py", line 570, in post
return self.getresp()
File "/usr/lib/python2.5/nntplib.py", line 219, in getresp
raise NNTPTemporaryError(resp)
nntplib.NNTPTemporaryError: 441 Article has no body -- just headers
>>> buffer.getvalue()
'From: root at laerdal.dk\nSubject: testing\nNewsgroups: test\nBody:
\n\n\nfoobar\n\n\n.\n\n\n'
>>> f = open('/tmp/article')
>>> s=nntplib.NNTP('dknntp.laerdal.global')
>>> s.post(f)
'240 Article posted <gvjaqv$k91$1 at dknntp.laerdal.global>'
>>> f = open('/tmp/article')
>>> f.read()
'From: root at laerdal.dk\nSubject: testing\nNewsgroups: test\nBody:
\n\n\nfoobar\n\n\n.\n\n\n'
>>> buffer.getvalue()
'From: root at laerdal.dk\nSubject: testing\nNewsgroups: test\nBody:
\n\n\nfoobar\n\n\n.\n\n\n'
>>> f = open('/tmp/article')
>>> if f.read() == buffer.getvalue():
... print 'true'
...
true
More information about the Python-list
mailing list