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