Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

wikipedia.exceptions.WikipediaException: An unknown error occured: "The "srsearch" parameter must be set."

Open jcfk opened this issue 6 years ago • 13 comments

This comes from a simple wikipedia.page(title) call. I do not have access to the particular title in question, unfortunately.

jcfk avatar Aug 28 '18 07:08 jcfk

Hi,

I was executing for title page ".deb" ->wikipedia.page(".deb") and I got following exception (DisambiguationError) and 1 error. If I try to catch the exception, the error is still there.

Traceback (most recent call last):
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_api.py", line 52, in get_object
    self.articleObject = wikipedia.page(self.articleName, auto_suggest=True)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/wikiEnv/lib/python3.7/site-packages/wikipedia/wikipedia.py", line 276, in page
    return WikipediaPage(title, redirect=redirect, preload=preload)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/wikiEnv/lib/python3.7/site-packages/wikipedia/wikipedia.py", line 299, in __init__
    self.__load(redirect=redirect, preload=preload)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/wikiEnv/lib/python3.7/site-packages/wikipedia/wikipedia.py", line 393, in __load
    raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
wikipedia.exceptions.DisambiguationError: "Deb" may refer to: 
Deb (surname)
Deb (given name)
débutante
Dynamic energy budget theory
Epidermolysis bullosa dystrophica
Digital Economy Act 2010
Digital Economy Act 2017
German Ice Hockey Federation
Diepoxybutane
New South Wales 900/800 class railcar
deb (file format)
Debrecen International Airport
Deb Shops
Deb (album)
Debs (disambiguation)
Debra (disambiguation)
Debbie (disambiguation)
Deborah (disambiguation)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 93, in <module>
    run_main()
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 86, in run_main
    answer = wikiAnswer.run_wikipedia_search(inputObject)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 65, in run_wikipedia_search
    self.run_wiki_help(visited, inputObject.startPage)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 39, in run_wiki_help
    self.run_wiki_help(visited, article)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 39, in run_wiki_help
    self.run_wiki_help(visited, article)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 39, in run_wiki_help
    self.run_wiki_help(visited, article)
  [Previous line repeated 6 more times]
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 37, in run_wiki_help
    for article in self.get_wiki_object(articleName):
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_game.py", line 15, in get_wiki_object
    articleObject.get_object()
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/src/wikipedia_api.py", line 65, in get_object
    self.articleObject = wikipedia.page(articleModified)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/wikiEnv/lib/python3.7/site-packages/wikipedia/wikipedia.py", line 270, in page
    results, suggestion = search(title, results=1, suggestion=True)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/wikiEnv/lib/python3.7/site-packages/wikipedia/util.py", line 28, in __call__
    ret = self._cache[key] = self.fn(*args, **kwargs)
  File "/Users/wikip/Documents/PyCharm/WikipediaGame/wikiEnv/lib/python3.7/site-packages/wikipedia/wikipedia.py", line 109, in search
    raise WikipediaException(raw_results['error']['info'])
wikipedia.exceptions.WikipediaException: An unknown error occured: "The "srsearch" parameter must be set.". Please report it on GitHub!

AlmasM avatar Feb 11 '19 18:02 AlmasM

I also got the error when working with wikipedia module in visual studio please share solution

Exception has occurred: WikipediaException An unknown error occured: "The "srsearch" parameter must be set."

VikasPatelVkp avatar Sep 06 '19 12:09 VikasPatelVkp

Has anyone come up with solution? I've got the same error

madeofstardust avatar Sep 09 '19 13:09 madeofstardust

This still seems to be active

LSaldyt avatar Feb 10 '20 19:02 LSaldyt

Try converting your query in string format. results = wikipedia.summary(f'{query}', sentences=5 ) I converted my query in string format and now it is working properly

Gurkiratsinghk avatar Jul 07 '20 17:07 Gurkiratsinghk

NameError: name 'query' is not defined

kayode0x avatar Jul 17 '20 04:07 kayode0x

> NameError: name 'query' is not defined

Try using this: elif 'wikipedia' in query: speak("Searching") query = ("wikipedia","") result = wikipedia.summary(f'{query}', sentences=2) print(result) speak(result)

instead of def

bansaladi avatar Jul 17 '20 17:07 bansaladi

> NameError: name 'query' is not defined

Try using this: elif 'wikipedia' in query: speak("Searching") query = ("wikipedia","") result = wikipedia.summary(f'{query}', sentences=2) print(result) speak(result)

instead of def

yeah but i got still error

pujoseno avatar Sep 21 '20 11:09 pujoseno

I have also faced this problem. How do I fix it.

rk-poddar avatar Sep 08 '22 09:09 rk-poddar

wikipedia.exceptions.WikipediaException: An unknown error occured: "The "srsearch" parameter must be set.". Please report it on GitHub!

I am facing the same error too

yefhieu avatar Nov 18 '22 16:11 yefhieu

An unknown error occured: "The "srsearch" parameter must be set.". Please report it on GitHub! I am also facing the same issues

Any solution ?

Niagawan-mave avatar Dec 13 '22 08:12 Niagawan-mave

I have found the problem, this error come out is because that in wikipedia.search(keyword), the keyword is null, that why the error say the parameter need to be set. So we just need to ensure that the parameter passed to the function is not null example if(len(keyword>0): ..... your coding result = wikipedia.search(keyword)

Niagawan-mave avatar Dec 13 '22 08:12 Niagawan-mave

I have found the problem, this error come out is because that in wikipedia.search(keyword), the keyword is null, that why the error say the parameter need to be set. So we just need to ensure that the parameter passed to the function is not null example if(len(keyword>0): ..... your coding result = wikipedia.search(keyword)

i did it but i got still error

rubyazz avatar Jan 09 '23 08:01 rubyazz