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

Discussion in 'Python' started by Jon Bendtsen, May 27, 2009.

  1. Jon Bendtsen

    Jon Bendtsen Guest

    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: \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$>'


    >>> f = open('/tmp/article')
    >>> f.read()

    'From: \nSubject: testing\nNewsgroups: test\nBody:
    \n\n\nfoobar\n\n\n.\n\n\n'
    >>> buffer.getvalue()

    'From: \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
    Jon Bendtsen, May 27, 2009
    #1
    1. Advertising

  2. Re: nntplib.NNTPTemporaryError: 441 Article has no body -- justheaders

    On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen <>
    declaimed the following in gmane.comp.python.general:

    > 'From: \nSubject: testing\nNewsgroups: test\nBody:
    > \n\n\nfoobar\n\n\n.\n\n\n'
    >

    I believe NNTP, like SMTP, requires \r\n line termination.
    --
    Wulfraed Dennis Lee Bieber KD6MOG

    HTTP://wlfraed.home.netcom.com/
    (Bestiaria Support Staff: )
    HTTP://www.bestiaria.com/
    Dennis Lee Bieber, May 28, 2009
    #2
    1. Advertising

  3. Jon Bendtsen

    Jon Bendtsen Guest

    Re: nntplib.NNTPTemporaryError: 441 Article has no body -- justheaders

    Dennis Lee Bieber wrote:
    > On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen <>
    > declaimed the following in gmane.comp.python.general:
    >
    >> 'From: \nSubject: testing\nNewsgroups: test\nBody:
    >> \n\n\nfoobar\n\n\n.\n\n\n'
    >>

    > 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.
    Jon Bendtsen, May 28, 2009
    #3
  4. Jon Bendtsen

    Jon Bendtsen Guest

    Re: nntplib.NNTPTemporaryError: 441 Article has no body -- justheaders

    Jon Bendtsen wrote:
    > Dennis Lee Bieber wrote:
    >> On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen <>
    >> declaimed the following in gmane.comp.python.general:
    >>
    >>> 'From: \nSubject: testing\nNewsgroups: test\nBody:
    >>> \n\n\nfoobar\n\n\n.\n\n\n'
    >>>

    >> 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.


    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
    Jon Bendtsen, Jun 4, 2009
    #4
  5. Jon Bendtsen

    Jon Bendtsen Guest

    Re: nntplib.NNTPTemporaryError: 441 Article has no body -- justheaders

    Jon Bendtsen wrote:
    > Jon Bendtsen wrote:
    >> Dennis Lee Bieber wrote:
    >>> On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen <>
    >>> declaimed the following in gmane.comp.python.general:
    >>>
    >>>> 'From: \nSubject: testing\nNewsgroups: test\nBody:
    >>>> \n\n\nfoobar\n\n\n.\n\n\n'
    >>>>
    >>> 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.

    >
    > 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.
    Jon Bendtsen, Jun 4, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rakesh

    nntplib: abstraction of threads

    Rakesh, Jan 16, 2005, in forum: Python
    Replies:
    4
    Views:
    291
  2. Replies:
    2
    Views:
    306
  3. Hanman

    get "in reply to" with nntplib

    Hanman, Apr 24, 2006, in forum: Python
    Replies:
    0
    Views:
    267
    Hanman
    Apr 24, 2006
  4. Helmut Jarausch

    NNTPlib::xover problem

    Helmut Jarausch, Aug 7, 2006, in forum: Python
    Replies:
    2
    Views:
    343
    Helmut Jarausch
    Aug 7, 2006
  5. Ron Garret
    Replies:
    10
    Views:
    754
    Diez B. Roggisch
    Jan 18, 2009
Loading...

Share This Page