[Tutor] Uncertain about exceptions

Matej Cepl ceplm at seznam.cz
Wed Jul 6 10:04:26 CEST 2005


Hi,

I have here two Python modules (see attached), where newsparser.py defines
(among other things) an object SoupReader and an exception
PageNotAvailable. This object (or its children) is then periodically
created in a loop in reprocess.py.

Now, my question is concerned with the use of exception in SoupReader.suck.
The idea is that when the page is not available for download, whole object
goes up in flames, the rest of SoapReader.__init__ is skipped over, and the
exception is then caught in reprocess.py cycle, which makes a note in some
errorlog, that this particular page has not been downloaded, but otherwise
the script continues for other pages. Is it what I am doing here or did I
missed the idea of exceptions at all?

Thanks for any answer,

        Matej

-- 
Matej Cepl, http://www.ceplovi.cz/matej/blog/
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
 
I used to date a woman who did PR and marketing for MS, so you
can imagine we had some in-depth and sometimes heated
discussions about MS vs. Linux and Macs.
Well, one day we were going hiking, and she presented me with
a really nice backback. The only issue with it was that it had
the MS logo emblazoned all over it. Of course, she knew
I wouldn't refuse it.
Anyway, she said to me, "Isn't that nice? See? What'd RedHat
ever give you for free?"
I replied, "An operating system."
That was one long, quiet hike.
      -- disserto on Slashdot
         http://slashdot.org/comments.pl\
         ?sid=138492&tid=109&mode=thread&cid=11590292
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newsparser.py
Type: application/x-python
Size: 13349 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20050706/765acc21/newsparser.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reprocess.py
Type: application/x-python
Size: 2031 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20050706/765acc21/reprocess.bin


More information about the Tutor mailing list