Bugs item #2629586, was opened at 2009-02-23 03:41 Message generated for change (Comment added) made by russblau You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2629586...
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: rewrite Group: None
Status: Pending
Resolution: None Priority: 5 Private: No Submitted By: NicDumZ — Nicolas Dumazet (nicdumz) Assigned to: Russell Blau (russblau) Summary: TerminalHandler.emit crashes when message is a string
Initial Comment: Sometimes self.format(record) can return a string, and this case is currently not handled.
How to trigger this behavior ? 1) modify Site.loadpageinfo() so that the error "u"loadpageinfo: Query on %s returned data on '%s' will be raised everytime. 2) run category.py move -from:nonasciititle -to:nonasciititle2 3) the loadpageinfo error will be triggered; category.py will catch this Error at top-level and will call pywikibot.logging.exception("Fatal error:") Here, this gives : pywikibot/scripts$ python category.py move -from:"Athlète du combiné nordique aux Jeux olympiques" -to:"Coureur du combiné nordique aux Jeux olympiques" -debug Reading dump from category.dump.bz2 Found 1 wikipedia:fr processes running, including this one. Traceback (most recent call last): File ".../pywikibot/bot.py", line 95, in emit "xmlcharrefreplace")) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 671: ordinal not in range(128) Dumping to category.dump.bz2, please wait...
I don't understand exactly how a string is returned by format(), and why a unicode message is expected, but it happens. The stacktrace here is parcticularly cryptic. True, I'm still not used to the logging system, but I had to place manually old-fashioned "print"s everywhere to track the issue and understand what CAUSED this. :/
I have patched emit() in r6423 so it doesn't crash on a string message. However, Russ, I think that you might want to fix the source of the problem, in the logging system itself, rather than solving the effect. Feel free to revert this :)
----------------------------------------------------------------------
Comment By: Russell Blau (russblau)
Date: 2010-01-06 14:04
Message: I'm not sure if there is anything here that still needs to be fixed; fixing bugs in the logging module is certainly outside the abilities of this project! ;-)
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2629586...
pywikipedia-bugs@lists.wikimedia.org