nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

J

Jon Bendtsen

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?
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'From: (e-mail address removed)\nSubject: testing\nNewsgroups: test\nBody:
\n\n\nfoobar\n\n\n.\n\n\n'

'From: (e-mail address removed)\nSubject: testing\nNewsgroups: test\nBody:
\n\n\nfoobar\n\n\n.\n\n\n''From: (e-mail address removed)\nSubject: testing\nNewsgroups: test\nBody:
\n\n\nfoobar\n\n\n.\n\n\n'.... print 'true'
....
true
 
J

Jon Bendtsen

Dennis said:
I believe NNTP, like SMTP, requires \r\n line termination.

I will try it, but why does it then work when it posts the file? The
file is a std. unix file, so it should also only have \n line
termination.
 
J

Jon Bendtsen

Jon said:
I will try it, but why does it then work when it posts the file? The
file is a std. unix file, so it should also only have \n line
termination.

I have now tried adding \r infront of all \n. That didnt help.

I tried making a tempfile.TemporaryFile(dir='/tmp') which did not
work either. Message is still:

nntplib.NNTPTemporaryError: 441 Article has no body -- just headers
 
J

Jon Bendtsen

Jon said:
I have now tried adding \r infront of all \n. That didnt help.

I tried making a tempfile.TemporaryFile(dir='/tmp') which did not
work either. Message is still:

nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

with the help of #python on Freenode i found the problem. I didnt
seek back to 0. With seeking stringio works, and then i will use that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top