I have recently upgrade BeautifulSoup from version 3.0 to version 4.1 on a Windows machine.
I am now getting a strange error:
File "C:pathomyscript.py", line 23
0, in soupify
return BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
AttributeError: type object 'BeautifulSoup' has no attribute 'HTML_ENTITIES'
Here is the snippet of code that causes the exception to be thrown:
def soupify(html):
return BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
The doc for BS does not mention how the constructor signature has changed fro v3 to v4. How may I fix this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…