DragonComputer / Dragonfire

the open-source virtual assistant for Ubuntu based Linux distributions
http://dragon.computer
MIT License
1.39k stars 209 forks source link

DisambiguationError of wikipedia module shuts down Dragonfire #21

Closed mertyildiran closed 6 years ago

mertyildiran commented 7 years ago
You: WHERE IS CABO
Dragonfire: JUST A SECOND
_______________________________________________________________

/home/mertyildiran/.local/lib/python2.7/site-packages/bs4/__init__.py:181: 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 11 of the file /home/mertyildiran/.local/bin/dragonfire. 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))
Traceback (most recent call last):
  File "/home/mertyildiran/.local/bin/dragonfire", line 11, in <module>
    load_entry_point('dragonfire', 'console_scripts', 'dragonfire')()
  File "/home/mertyildiran/Documents/Dragonfire/dragonfire/__init__.py", line 496, in initiate
    command(speech)
  File "/home/mertyildiran/Documents/Dragonfire/dragonfire/__init__.py", line 405, in command
    userin.say(omniscient_.respond(original_com))
  File "/home/mertyildiran/Documents/Dragonfire/dragonfire/omniscient.py", line 42, in respond
    page = wikipedia.page(wikipedia.search(query)[0])
  File "/home/mertyildiran/.local/lib/python2.7/site-packages/wikipedia/wikipedia.py", line 276, in page
    return WikipediaPage(title, redirect=redirect, preload=preload)
  File "/home/mertyildiran/.local/lib/python2.7/site-packages/wikipedia/wikipedia.py", line 299, in __init__
    self.__load(redirect=redirect, preload=preload)
  File "/home/mertyildiran/.local/lib/python2.7/site-packages/wikipedia/wikipedia.py", line 393, in __load
    raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
wikipedia.exceptions.DisambiguationError: "Cabo" may refer to: 
Cabó
Cabo Blanco, Costa Rica
Cabo Delgado
Cabo Frio
Cabo Orange National Park
Cabo Polonio
Cabo San Lucas
Cabo Verde
San José del Cabo
Cabo Catoche
Cabo Corrientes
Cabo de São Vicente
Cape Delgado
Cabo Girão
Cabo Meredith
Cabo (card game)
Cabo Wabo
Cabo Yachts
California Association of Bicycling Organizations
Council of American Building Officials
Cabo Blanco (disambiguation)
Cabo Rojo (disambiguation)
Gabo (disambiguation)
Cabos
mertyildiran commented 6 years ago

Fixed with https://github.com/DragonComputer/Dragonfire/commit/ee0bed19ed9c3b8b2713fbcf508537088e325f15