goldsmith / Wikipedia

A Pythonic wrapper for the Wikipedia API
https://wikipedia.readthedocs.org/
MIT License
2.87k stars 519 forks source link

UserWarning: No parser explicitly specified #225

Open AkiMosi opened 4 years ago

AkiMosi commented 4 years ago
UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 389 of the file /usr/local/lib/python3.6/dist-packages/wikipedia/wikipedia.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.

  lis = BeautifulSoup(html).find_all('li')

First of all thanks for this wonderful Package. It is really useful for my web scraper code. I am getting the above warning. Which is not an error or issue but it would be nice to keep your package perfect.

bsoyka commented 4 years ago

This issue has already been fixed, as shown here:

https://github.com/goldsmith/Wikipedia/blob/2065c568502b19b8634241b47fd96930d1bf948d/wikipedia/wikipedia.py#L389

However, @goldsmith still needs to push the updated package up to PyPI so people can use the updated version on there.

As a temporary fix for this, you can install the module directly from this repo using the following command:

python -m pip install --upgrade git+git://github.com/goldsmith/Wikipedia.git

This command replaces your current installation of the wikipedia module with the most recent version from here on GitHub.

Luen commented 4 months ago

107