http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9140
Revision: 9140 Author: russblau Date: 2011-03-31 14:07:06 +0000 (Thu, 31 Mar 2011) Log Message: ----------- Prevent bot from crashing on unprintable error message.
Modified Paths: -------------- branches/rewrite/scripts/redirect.py
Modified: branches/rewrite/scripts/redirect.py =================================================================== --- branches/rewrite/scripts/redirect.py 2011-03-31 13:42:35 UTC (rev 9139) +++ branches/rewrite/scripts/redirect.py 2011-03-31 14:07:06 UTC (rev 9140) @@ -1,3 +1,4 @@ +#! /usr/bin/python # -*- coding: utf-8 -*- """ Script to resolve double redirects, and to delete broken redirects. Requires @@ -473,8 +474,11 @@ u'Warning: Redirect target section %s doesn't exist.' % newRedir.title(asLink=True)) except pywikibot.CircularRedirect, e: - pywikibot.warning(u"Skipping circular redirect: [[%s]]" - % str(e)) + try: + pywikibot.warning(u"Skipping circular redirect: [[%s]]" + % str(e)) + except UnicodeDecodeError: + pywikibot.warning(u"Skipping circular redirect") break except pywikibot.BadTitle, e: # str(e) is in the format 'BadTitle: [[Foo]]'