jenkins-bot has submitted this change and it was merged.
Change subject: fix for UnicodeDecodeError with CircularRedirect exception ......................................................................
fix for UnicodeDecodeError with CircularRedirect exception
- CircularRedirect is derived from PageRelatedError - call pywikibot.exception to print the error message
Change-Id: I6b3fa1175d2c51736a7d880845d3519f091ddc53 --- M pywikibot/exceptions.py M scripts/redirect.py 2 files changed, 4 insertions(+), 6 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py index 75c363b..b7a4fd5 100644 --- a/pywikibot/exceptions.py +++ b/pywikibot/exceptions.py @@ -78,7 +78,7 @@ message = u"Page %s is not a redirect page."
-class CircularRedirect(Error): +class CircularRedirect(PageRelatedError):
"""Page is a circular redirect
@@ -87,6 +87,7 @@ or indirectly redirects back to this one)
""" + message = u"Page %s is a circular redirect."
class InvalidTitle(Error): diff --git a/scripts/redirect.py b/scripts/redirect.py index d5649e9..7d681fc 100755 --- a/scripts/redirect.py +++ b/scripts/redirect.py @@ -569,11 +569,8 @@ u"Redirect target section %s doesn't exist." % newRedir.title(asLink=True)) except pywikibot.CircularRedirect as e: - try: - pywikibot.warning(u"Skipping circular redirect: [[%s]]" - % str(e)) - except UnicodeDecodeError: - pywikibot.warning(u"Skipping circular redirect") + pywikibot.exception(e) + pywikibot.output(u"Skipping %s." % newRedir) break except pywikibot.BadTitle as e: # str(e) is in the format 'BadTitle: [[Foo]]'
pywikibot-commits@lists.wikimedia.org