Re: [Tutor] Exception repeated in a loop

2005-12-06 Thread Jan Eden
Kent Johnson wrote on 06.12.2005: >The parser processes up to the error. It never recovers from the >error. HTMLParser has an internal buffer and buffer pointer that is >never advanced when an error is detected; each time you call feed() >it tries to parse the remaining data and gets the same erro

Re: [Tutor] Exception repeated in a loop

2005-12-06 Thread Jan Eden
Hi, Nelson, Scott wrote on 06.12.2005: >An unhandled exception immediately stops the execution of your code. > >A handled exception (try/except) does not stop code execution (unless >you explicitly tell it to). > >This shows how a handled exception does not stop code execution: > >try: > raise

Re: [Tutor] Exception repeated in a loop

2005-12-06 Thread Kent Johnson
Jan Eden wrote: >Hi, > >I use the following loop to parse some HTML code: > >for record in data: >try: >parser.feed(record['content']) >except HTMLParseError, (msg): >print "!!!Parsing error in", record['page_id'], ": ", msg > >Now after HTMLParser encounters a parse error

Re: [Tutor] Exception repeated in a loop

2005-12-06 Thread Nelson, Scott
aught exception' print 'fell through' Hope this helps... -Scott -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jan Eden Sent: Tuesday, December 06, 2005 10:24 AM To: Pawel Kraszewski; tutor@python.org Subject: Re: [Tutor] Exception repeated

Re: [Tutor] Exception repeated in a loop

2005-12-06 Thread Jan Eden
Hi Pawel, Pawel Kraszewski wrote on 06.12.2005: >Dnia wtorek, 6 grudnia 2005 16:29, Jan Eden napisa?: >> Hi, >> >> I use the following loop to parse some HTML code: >> >> for record in data: >> try: >> parser.feed(record['content']) >> except HTMLParseError, (msg): >> prin

Re: [Tutor] Exception repeated in a loop

2005-12-06 Thread Pawel Kraszewski
Dnia wtorek, 6 grudnia 2005 16:29, Jan Eden napisaƂ: > Hi, > > I use the following loop to parse some HTML code: > > for record in data: > try: > parser.feed(record['content']) > except HTMLParseError, (msg): > print "!!!Parsing error in", record['page_id'], ": ", msg > > No

[Tutor] Exception repeated in a loop

2005-12-06 Thread Jan Eden
Hi, I use the following loop to parse some HTML code: for record in data: try: parser.feed(record['content']) except HTMLParseError, (msg): print "!!!Parsing error in", record['page_id'], ": ", msg Now after HTMLParser encounters a parse error in one record, it repeats to