问题描述
我要用GUI制作字典程序,但我遇到了第一个障碍.我刚刚安装了一个模块( PyDictionary ),但是当我运行以下代码时,出现错误.
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"))
返回哪个
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']}
推荐答案
如此处.之所以抛出BeautifulSoup错误,是因为PyDictionary是使用BeautifulSoup实现的.
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.
但是,问题似乎已得到解决.您是否使用pip安装了PyDictionary?如果是这样,请尝试直接从GitHub repo 此处进行安装.
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.
我使用回购协议进行了安装测试,此问题已解决.我建议您也这样做.如果您不确定如何执行此操作,请随时询问.
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.
这篇关于当我不使用BeautifulSoup时如何摆脱BeautifulSoup html解析器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!