question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wikipedia page id in wikipedia.page error does not match search query

See original GitHub issue

Trying to access a valid wikipedia page (with redirect, see https://en.wikipedia.org/wiki/Petawatt) this error is thrown:

>>> wikipedia.page("Petawatt")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/share/virtualenvs/quantulum3-mx2jnqkR/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 276, in page
    return WikipediaPage(title, redirect=redirect, preload=preload)
  File "/home/user/.local/share/virtualenvs/quantulum3-mx2jnqkR/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 299, in __init__
    self.__load(redirect=redirect, preload=preload)
  File "/home/user/.local/share/virtualenvs/quantulum3-mx2jnqkR/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 345, in __load
    raise PageError(self.title)
wikipedia.exceptions.PageError: Page id "per watt" does not match any pages. Try another id!

The PageError contains a wrong id following this legitimate search query. This does not occur if auto_suggest is turned off. Anyway the title shouldn’t be changed in the pageerror on my opinion.

>>> wikipedia.page("Petawatt", auto_suggest=False)
<WikipediaPage 'Watt'>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

10reactions
kylebarroncommented, Jan 29, 2020

Yeah I find that I need to set auto_suggest=False when I know the page names I have exist, i.e. I’ve gotten the names from wikipedia.search().

2reactions
triposatcommented, May 19, 2021

wikipedia.summary(Query, sentences=2, auto_suggest=False, redirect=True), It’s working!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Loading page from wikipedia search query errors ...
I fixed this error by looking at the github solved issues. When running the below line auto suggest is set automatically to true...
Read more >
Wikipedia:Page name
Page name is a term that is used to refer to any page that is sent from a Wikipedia database. It does not...
Read more >
wikipedia 0.9 documentation
Exception raised when no Wikipedia matched a query. exception wikipedia.exceptions. RedirectError (title)¶. Exception raised when a page title ...
Read more >
Wikipedia-API - PyPI
Class WikipediaPage has property summary, which returns description of Wiki page. import wikipediaapi wiki_wiki = wikipediaapi.Wikipedia('en') ...
Read more >
Python Programing Hello. I'm having a problem | Chegg.com
I'm trying to use Python library called Wikipedia its wrapper for Wikipedia API. ... Page id lexus company does not match any pages...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found