jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/457442 )
Change subject: [bugfix] Solve UnicodeDecodeError in site.getredirtarget ......................................................................
[bugfix] Solve UnicodeDecodeError in site.getredirtarget
This partly reverts I4b6d7f32fc1ec
Bug: T126192 Change-Id: Ibf9ee23573c46b291fcfa435b77d7bde830d7911 --- M pywikibot/site.py 1 file changed, 4 insertions(+), 4 deletions(-)
Approvals: Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index 3671dc7..be63f15 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -3204,8 +3204,8 @@ result = query.submit() if "query" not in result or "redirects" not in result["query"]: raise RuntimeError( - "getredirtarget: No 'redirects' found for page %s." - % title.encode(self.encoding())) + "getredirtarget: No 'redirects' found for page {}." + .format(title))
redirmap = {item['from']: {'title': item['to'], 'section': '#' @@ -3223,8 +3223,8 @@
if title not in redirmap: raise RuntimeError( - "getredirtarget: 'redirects' contains no key for page %s." - % title.encode(self.encoding())) + "getredirtarget: 'redirects' contains no key for page {}." + .format(title)) target_title = u'%(title)s%(section)s' % redirmap[title]
if self.sametitle(title, target_title):
pywikibot-commits@lists.wikimedia.org