0

I made a simple dictionary in python. Here's the code:

from PyDictionary import PyDictionary


def function():
    x = input("Look up: ")
    print(PyDictionary.meaning(x))
    function()


def main():
   function()


if __name__ == '__main__':
    main()

When I run it, I get this error message:

UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this 
system ("html.parser"). 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 5 of the file 
C:\Users\ethan\AppData\Roaming\Python\Python38\site-packages\PyDictionary\utils.py. To get rid 
of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup 
constructor.

return BeautifulSoup(requests.get(url).text)

Does anyone know how to get rid of it? I also don't know what the "BeautifulSoup constructor" is.

My python build:

PyCharm 2019.3.3 (Community Edition)
Build #PC-193.6494.30, built on February 6, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 4
Registry: 
Non-Bundled Plugins: aws.toolkit
  • It's not an error, it's a `UserWarning`, so a _warning_, and can be ignored in this case, in my opinion. Side note: you _really_ don't want to call `function` inside itself like this - it'll cause infinite recursion that'll trigger a runtime error at some point – ForceBru Mar 02 '20 at 18:27
  • Python has functions to turn off warning - you should find it in Google. You could also check documentation if `PyDictionary` doesn't accept option for `BeautifulSoup()` because it warns that it expects second argument - ie. `"html.parser"`. OR you can send message with issue to PyDictionary's author and maybe it will fix it. – furas Mar 02 '20 at 18:46

0 Answers0