Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'langlinks' #20

Closed
kercos opened this issue Mar 29, 2019 · 1 comment
Closed

KeyError: 'langlinks' #20

kercos opened this issue Mar 29, 2019 · 1 comment
Assignees
Labels

Comments

@kercos
Copy link

kercos commented Mar 29, 2019

Hi,

looks like there is an KeyError when trying to access langlinks from a page without external links to other languages.

import wikipediaapi
wiki_wiki = wikipediaapi.Wikipedia('it')
page_py = wiki_wiki.page('ago_crinale')
page_py = wiki_wiki.page('ago_crinale')
page_py.exists()
# True
langlinks = page_py.langlinks

I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wikipediaapi/__init__.py", line 949, in langlinks
    self._fetch('langlinks')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wikipediaapi/__init__.py", line 1017, in _fetch
    getattr(self.wiki, '_' + call)(self)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wikipediaapi/__init__.py", line 322, in _langlinks
    return self._build_langlinks(v, page)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wikipediaapi/__init__.py", line 561, in _build_langlinks
    for langlink in extract['langlinks']:
KeyError: 'langlinks'
@martin-majlis
Copy link
Owner

Thanks for reporting. It is fixed and released in new version 0.4.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants