https://bugzilla.wikimedia.org/show_bug.cgi?id=54572
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- We can't fix it in output() because we have an exception before we entered in output().
What about just replace output(u'%s' %e) -> output(str(e)) ? it works.