abszeph
04-20-2003, 10:26 PM
I've got a question about exception handling.
Is there any way to clear the error?
I've got some error handling code in a for loop, and I can't figure out how to clear the error state.
for file in os.listdir('mydir'):
file = "mydir/%s" % file
print "Processing %s" % file
f = open(file, 'r')
#grab the documents
try:
pURL.feed(f.read())
pURL.close()
except sgmllib.SGMLParseError:
continue
One malformed document causes the rest of the directory to get skipped. Any ideas?
Thanks...
Is there any way to clear the error?
I've got some error handling code in a for loop, and I can't figure out how to clear the error state.
for file in os.listdir('mydir'):
file = "mydir/%s" % file
print "Processing %s" % file
f = open(file, 'r')
#grab the documents
try:
pURL.feed(f.read())
pURL.close()
except sgmllib.SGMLParseError:
continue
One malformed document causes the rest of the directory to get skipped. Any ideas?
Thanks...