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: r...@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$k9...@dknntp.laerdal.global>' >>> f = open('/tmp/article') >>> f.read() 'From: r...@laerdal.dk\nsubject: testing\nNewsgroups: test\nBody: \n\n\nfoobar\n\n\n.\n\n\n' >>> buffer.getvalue() 'From: r...@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 -- http://mail.python.org/mailman/listinfo/python-list