[Mailman-Developers] Problem with runner logger with unicode
nicolas
nicolas at karageuzian.com
Tue Dec 3 12:09:42 CET 2013
Hi,
I encountered a subtil problem when a component logs unicode strings
(present case was the hyperkitty archiver) :
(py27)mailman at mail:~$ Traceback (most recent call last):
File "/home/mailman/mailman/src/mailman/core/logging.py", line 76, in
emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 723, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 464, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/__init__.py", line 328, in
getMessage
msg = msg % self.args
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
21: ordinal not in range(128)
Logged from file runner.py, line 261
Traceback (most recent call last):
File "/home/mailman/mailman/src/mailman/core/logging.py", line 76, in
emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 723, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 464, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/__init__.py", line 328, in
getMessage
msg = msg % self.args
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
2982: ordinal not in range(128)
Logged from file runner.py, line 264
then found how to fix it :
=== modified file 'src/mailman/core/runner.py'
--- src/mailman/core/runner.py 2013-12-01 13:28:49 +0000
+++ src/mailman/core/runner.py 2013-12-03 10:47:56 +0000
@@ -258,10 +258,10 @@
self.switchboard.enqueue(msg, msgdata)
def _log(self, exc):
- elog.error('Uncaught runner exception: %s', exc)
+ elog.error(b'Uncaught runner exception: %s', exc)
s = StringIO()
traceback.print_exc(file=s)
- elog.error('%s', s.getvalue())
+ elog.error(b'%s', s.getvalue())
def _clean_up(self):
"""See `IRunner`."""
unless it can be considered as a problem in the component itself...
But (personal thought) mailman's stability may not depend of third
party components...
I can propose a merge for it if it's revelant (just have to go deeper
into lp/bzr)
Cheers
Nico
More information about the Mailman-Developers
mailing list