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

Wikipedia urls with special characters result in an error #724

Closed
Tomin1 opened this issue Jan 28, 2015 · 0 comments
Closed

Wikipedia urls with special characters result in an error #724

Tomin1 opened this issue Jan 28, 2015 · 0 comments
Labels
Bug Things to squish; generally used for issues Easyfix Bugs or Tweaks that are easy for a new contributor to fix or implement

Comments

@Tomin1
Copy link
Contributor

Tomin1 commented Jan 28, 2015

I get this error:

18:29 <Willie> KeyError: u'extract' (file 
"/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 83, 
               in mw_snippet)

When I give Wille an url like this: http://en.wikipedia.org/wiki/Troll_%28Internet%29
The reason are the percent encoded characters in the url. To fix this I made some modifications to my wikipedia.py but they are not compatible with Python 2, I think, and might not be the proper way to solve this problem. To see the code I wrote see this commit: https://github.com/Tomin1/willie/commit/019848763594da688ae6ed79e180373d8c472694 Anyway I think more time and thinking about this problem is needed and this fix is not final and should not be merged.

Some more information:
exceptions.log:

Signature: KeyError: u'extract' (file "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 83, in mw_snippet)
from Tomi at 2015-01-28 18:29:59.907542. Message was: http://en.wikipedia.org/wiki/Troll_%28Internet%29
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/willie/bot.py", line 634, in call
    exit_code = func(willie, trigger)
  File "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 93, in mw_info
    say_snippet(bot, match.group(1), match.group(2), show_url=False)
  File "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 60, in say_snippet
    snippet = mw_snippet(server, query)
  File "/usr/local/lib/python2.7/dist-packages/willie/modules/wikipedia.py", line 83, in mw_snippet
    return snippet['extract']
KeyError: u'extract'

Willie v. 5.0.0
Raspbian (Debian wheezy) on Raspberry Pi, installed with pip.

@embolalia embolalia added Bug Things to squish; generally used for issues Easyfix Bugs or Tweaks that are easy for a new contributor to fix or implement labels Feb 15, 2015
maxpowa pushed a commit to maxpowa/Inumuta that referenced this issue Feb 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Things to squish; generally used for issues Easyfix Bugs or Tweaks that are easy for a new contributor to fix or implement
Projects
None yet
Development

No branches or pull requests

2 participants