failure to raise DisambiguationError for "Leaching" page on Wikipedia
See original GitHub issueUsing pymediawiki 0.3.15 with Python 3.6.3 on Linux, I observed the following error when attempting to access the disambiguation page for “Leaching” on Wikipedia.
python -c "import mediawiki; wikipedia=mediawiki.MediaWiki(); wikipedia.page('Leaching')"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/lebedov/miniconda3/lib/python3.6/site-packages/mediawiki/mediawiki.py", line 731, in page
preload=preload)
File "/home/lebedov/miniconda3/lib/python3.6/site-packages/mediawiki/mediawikipage.py", line 72, in __init__
self.__load(redirect=redirect, preload=preload)
File "/home/lebedov/miniconda3/lib/python3.6/site-packages/mediawiki/mediawikipage.py", line 532, in __load
self._raise_disambiguation_error(page, pageid)
File "/home/lebedov/miniconda3/lib/python3.6/site-packages/mediawiki/mediawikipage.py", line 569, in _raise_disambiguation_error
one_disambiguation['title'] = item[0]['title']
File "/home/lebedov/miniconda3/lib/python3.6/site-packages/bs4/element.py", line 1011, in __getitem__
return self.attrs[key]
KeyError: 'title'
Relatedly, wikipedia 1.4.0 correctly raises a DisambiguationError
exception for the above.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Wikipedia disambiguation error - python - Stack Overflow
You could catch the DisambiguationError and chose one of these pages randomly. try: p = wikipedia.page(string) except wikipedia.DisambiguationError as e: s ...
Read more >Quickstart — wikipedia 0.9 documentation
summary will raise a DisambiguationError if the page is a disambiguation page, or a PageError if the page doesn't exist (although by default,...
Read more >why is the wikipedia api not working for me ? : r/learnpython
I wanted to try to use the Wikipedia api and was wondering if ... use page's error checking to raise DisambiguationError if necessary....
Read more >Wikipedia:Disambiguation
Disambiguation in Wikipedia is the process of resolving conflicts that arise when a potential article title is ambiguous, most often because it refers...
Read more >Getting Started with Python's Wikipedia API - Stack Abuse
In this article, we will be using the Wikipedia API to retrieve data ... wikipedia.summary will raise a "disambiguation error" if the page...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great catch, I hadn’t looked at the title portion in awhile. Would you like to open a new issue so that we can track this? Thanks!
@barrust : here’s an example for “Lincoln Museum” (https://en.wikipedia.org/wiki/Lincoln_Museum):
I’d expect the
title
here to be only “Ford’s Theatre” since that’s the title of the link, but instead thetitle
is the same as the fulldescription
(both areFord's Theatre, Washington, DC, USA — where Abraham Lincoln was assassinated; known as Lincoln Museum from 1936 to 1965 and legally "Ford's Theater (Lincoln Museum)" since 1965
).