How to get rid of the BeautifulSoup html parser error when I'm not using BeautifulSoup

情到浓时终转凉″ 提交于 2020-03-03 08:49:10

问题


I'm going to be making a dictionary program with a GUI but I fell at the first hurdle. I just installed a module (PyDictionary) but when I run the following code I get an error.

from PyDictionary import PyDictionary
dictionary = PyDictionary()
print(dictionary.meaning("fish"))

Which returns

The code that caused this warning is on line 3 of the file Dictionary.py. To 
get rid of this warning, change code that looks like this:

 BeautifulSoup(YOUR_MARKUP})

to this:

 BeautifulSoup(YOUR_MARKUP, "lxml")

  markup_type=markup_type))
{'Noun': ['any of various mostly cold-blooded aquatic vertebrates usually having scales and breathing through gills', 'the flesh of fish used as food', '(astrology', 'the twelfth sign of the zodiac; the sun is in this sign from about February 19 to March 20'], 'Verb': ['seek indirectly', 'catch or try to catch fish or shellfish']}

回答1:


It looks like this is a problem with PyDictionary, as noted here. The reason it is throwing a BeautifulSoup error is because PyDictionary is implemented using BeautifulSoup.

It looks like the issue may have been fixed, however. Did you install PyDictionary with pip? If so, try installing directly from the GitHub repo here.

Edit: I tested using the repo to install and the issue was resolved. I would advise you to do the same. If you're not sure how to do this feel free to ask.



来源:https://stackoverflow.com/questions/48046518/how-to-get-rid-of-the-beautifulsoup-html-parser-error-when-im-not-using-beautif

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!