Page MenuHomePhabricator

broken Page().text ?
Closed, ResolvedPublic

Description

Looks like a critical bug in pywikibot? (pywikibot-core updated today from github, Python 3.4.3)

>>> import pywikibot
>>> site = pywikibot.Site()
>>> site
APISite("pl", "wiktionary")
>>> page = pywikibot.Page(site, 'dog')
>>> page.text
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../pywikibot/core/pywikibot/page.py", line 503, in text
    self._text = self.get(get_redirect=True)
  File ".../pywikibot/core/pywikibot/tools/__init__.py", line 1327, in wrapper
    return obj(*__args, **__kw)
  File ".../pywikibot/core/pywikibot/page.py", line 370, in get
    self._getInternals(sysop)
  File ".../pywikibot/core/pywikibot/page.py", line 400, in _getInternals
    self.site.loadrevisions(self, getText=True, sysop=sysop)
  File ".../pywikibot/core/pywikibot/site.py", line 3751, in loadrevisions
    for pagedata in rvgen:
  File ".../pywikibot/core/pywikibot/data/api.py", line 2726, in __iter__
    self.data = self.request.submit()
  File ".../pywikibot/core/pywikibot/data/api.py", line 1913, in submit
    paramstring = self._http_param_string()
  File ".../pywikibot/core/pywikibot/data/api.py", line 1767, in _http_param_string
    return encode_url(self._encoded_items())
  File ".../pywikibot/core/pywikibot/data/api.py", line 3051, in encode_url
    query.sort(key=lambda x: x[0].lower().endswith('token') +
AttributeError: 'dict_items' object has no attribute 'sort'

user-config.py:

family = 'wiktionary'
mylang = 'pl'
usernames['wiktionary']['pl'] = u'AlkamidBot'

Event Timeline

Alkamid raised the priority of this task from to Needs Triage.
Alkamid updated the task description. (Show Details)
Alkamid added a project: Pywikibot.
Alkamid added a subscriber: Alkamid.

Change 258683 had a related patch set uploaded (by John Vandenberg):
Fix encode_url dict support on Python 3

https://gerrit.wikimedia.org/r/258683

Change 258683 merged by jenkins-bot:
Fix encode_url dict support on Python 3

https://gerrit.wikimedia.org/r/258683

Mpaa set Security to None.