NNTPlib::xover problem

Michiel Sikma michiel at thingmajig.org
Mon Aug 7 06:57:38 EDT 2006


Hi Helmut,

I guess it simply raises an exception in case there are no articles;  
this may not be what you expected, but it would seem that this is the  
way it operates. You should try catching the exception to plan out a  
course of action in case no articles are present.

Michiel

Op 7-aug-2006, om 12:50 heeft Helmut Jarausch het volgende geschreven:

> Hi
>
> I try to regularly extract recent news from some newsgroups.
> If News is an NNTP object I try
> (Response,Articles)= News.xover(str(int(Last)+1),'10000000')
> where 'Last' is the (previously saved) number of the last
> article read.
> If there are no new articles I get an Exception
>
> Traceback (most recent call last):
>    File "/home/jarausch/Python_My/News", line 36, in -toplevel-
>      (Response,Articles)= News.xover(str(int(Last)+1),'10000000')
>    File "/usr/local/lib/python2.4/nntplib.py", line 479, in xover
>      resp, lines = self.longcmd('XOVER ' + start + '-' + end, file)
>    File "/usr/local/lib/python2.4/nntplib.py", line 265, in longcmd
>      return self.getlongresp(file)
>    File "/usr/local/lib/python2.4/nntplib.py", line 236, in  
> getlongresp
>      resp = self.getresp()
>    File "/usr/local/lib/python2.4/nntplib.py", line 219, in getresp
>      raise NNTPTemporaryError(resp)
> NNTPTemporaryError: 420 No such article
>
>
> I would have expected to get an empty 'Response' or the value None
> for 'Articles'.
>
> What am I missing?
>
> (This is Python 2.4.3)
>
> Many thanks for a hint,
>
> Helmut Jarausch
>
> Lehrstuhl fuer Numerische Mathematik
> RWTH - Aachen University
> D 52056 Aachen, Germany
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list