Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

UserWarning: No parser explicitly specified

Open AkiMosi opened this issue 4 years ago • 2 comments

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.

AkiMosi avatar Apr 09 '20 18:04 AkiMosi

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.

bsoyka avatar Jun 17 '20 15:06 bsoyka

#107

Luen avatar Apr 30 '24 05:04 Luen