Bugs item #3059970, was opened at 2010-09-05 22:35 Message generated for change (Comment added) made by xqt You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3059970...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None
Status: Closed Resolution: Fixed
Priority: 5 Private: No Submitted By: Merlijn S. van Deen (valhallasw)
Assigned to: xqt (xqt)
Summary: Invalid image page title yields incorrect exception
Initial Comment: valhallasw@nightshade:~/src/pywikipedia/pywikipedia$ cat test.py # coding=utf-8 import wikipedia print wikipedia.ImagePage(wikipedia.getSite('en', 'wiktionary'), u'{{zh-lookup|吗}}').fileIsOnCommons();
wikipedia.ImagePage(wikipedia.getSite('en', 'wiktionary'), u'{{zh-lookup|吗}}').fileIsOnCommons();
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/valhallasw/src/pywikipedia/pywikipedia/wikipedia.py", line 3588, in fileIsOnCommons self._loadInfo() File "/home/valhallasw/src/pywikipedia/pywikipedia/wikipedia.py", line 3534, in _loadInfo if data['query']['pages'].values()[0]["imagerepository"] == "shared": KeyError: 'imagerepository'
-> if data['query']['pages'].values()[0]["imagerepository"] == "shared": (Pdb) dir() ['count', 'data', 'limit', 'params', 'self'] (Pdb) data {u'query': {u'pages': {u'-1': {u'invalid': u'', u'title': u'File:{{zh-lookup'}, u'-2': {u'invalid': u'', u'title': u'\u5417}}'}}}}
Obviously, this should have resulted in an InvalidTitle exception instead of a KeyError.
valhallasw@nightshade:~/src/pywikipedia/pywikipedia$ python version.py Pywikipedia (r-1 (unknown), 0 (unknown)) Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40) [GCC 4.3.2] config-settings: use_api = True use_api_login = True
Running r8370 (under git-svn)
----------------------------------------------------------------------
Comment By: xqt (xqt)
Date: 2010-09-07 22:25
Message: done in r8492
I've used wikipedia.badTitle error in same way as in _getEditPage()
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3059970...
pywikipedia-bugs@lists.wikimedia.org