I want that my script would continue running despite the error.
Code:
fw=open(fname,'r',encoding='utf-8')
bhtml=str(fw.readlines())
soup=BeautifulSoup(bhtml)
for tagdiv in soup.find_all("div", class_="hw_txt"):
word=tagdiv.get_text()
print(" replace word=",repr(word)) #gives error, interrupts script
print(" replace word=",word ).decode("utf-8","ignore") #gives error, interrupts script
try:
print(" replace word=",word)
except IOError:
pass
#gives error, interrupts script
Comment