goldsmith / Wikipedia

A Pythonic wrapper for the Wikipedia API
https://wikipedia.readthedocs.org/
MIT License
2.89k stars 519 forks source link

mutation of title while passing it to page #256

Open StTronn opened 4 years ago

StTronn commented 4 years ago

I tried to create a page with title EBay using following

s= search("EBay")
print (s)
ebay=page(title='EBay')
print(ebay)

Error:

PageError                                 Traceback (most recent call last)
<ipython-input-70-889ec26d05c3> in <module>()
      4 s= search("EBay")
      5 print (s)
----> 6 ebay=page(title='EBay')
      7 ebay

2 frames
/usr/local/lib/python3.6/dist-packages/wikipedia/wikipedia.py in page(title, pageid, auto_suggest, redirect, preload)
    274         # if there is no suggestion or search results, the page doesn't exist
    275         raise PageError(title)
--> 276     return WikipediaPage(title, redirect=redirect, preload=preload)
    277   elif pageid is not None:
    278     return WikipediaPage(pageid=pageid, preload=preload)

/usr/local/lib/python3.6/dist-packages/wikipedia/wikipedia.py in __init__(self, title, pageid, redirect, preload, original_title)
    297       raise ValueError("Either a title or a pageid must be specified")
    298 
--> 299     self.__load(redirect=redirect, preload=preload)
    300 
    301     if preload:

/usr/local/lib/python3.6/dist-packages/wikipedia/wikipedia.py in __load(self, redirect, preload)
    343     if 'missing' in page:
    344       if hasattr(self, 'title'):
--> 345         raise PageError(self.title)
    346       else:
    347         raise PageError(pageid=self.pageid)

PageError: Page id "e ay" does not match any pages. Try another id!

The following error is occurring seems like the title is interpreted as e ay while title was Ebay. Same happen ebay but if I pass E bay as an title the title is interpreted fine.

BL4CKR4VEN commented 3 years ago

I have the same problème but only when i change the language with set_lang()