[Pywikipedia-l] [ pywikipediabot-Bugs-2629586 ] TerminalHandler.emit crashes when message is a string

SourceForge.net noreply at sourceforge.net
Mon Feb 23 08:41:32 UTC 2009


Bugs item #2629586, was opened at 2009-02-23 09:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2629586&group_id=93107

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: Open
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 :)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2629586&group_id=93107



More information about the Pywikipedia-l mailing list