I have recently been using the wikipedia module to determine a random wikipedia page.
I have been doing this with a very large list of words, and the random.choice() module as so:
words=open("words.txt","r")
words=words.read()
words=words.split()
text=random.choice(words)
string=random.choice(wikipedia.search(text))
p = wikipedia.page(string)
The system appears to most often work, but will occasionally choke out the error:
Traceback (most recent call last):
File "/home/will/google4.py", line 25, in <module>
p = wikipedia.page(string)
File "/usr/local/lib/python2.7/dist-packages/wikipedia/wikipedia.py", line 276, in page
return WikipediaPage(title, redirect=redirect, preload=preload)
File "/usr/local/lib/python2.7/dist-packages/wikipedia/wikipedia.py", line 299, in __init__
self.__load(redirect=redirect, preload=preload)
File "/usr/local/lib/python2.7/dist-packages/wikipedia/wikipedia.py", line 393, in __load
raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
DisambiguationError: "The Scarf" may refer to:
The Scarf (film)
The Scarf (opera)
Scarf (disambiguation)
Arthur Stewart King Scarf
Is there anyway by which I can bypass this?