[New-bugs-announce] [issue7077] SysLogHandler can't handle Unicode

Robert Szefler report at bugs.python.org
Wed Oct 7 14:42:38 CEST 2009

New submission from Robert Szefler <robert.szefler at redefine.pl>:

Trying to .emit() a Unicode string causes an awkward exception to be thrown:

Traceback (most recent call last):
  File "/usr/lib/python2.5/logging/handlers.py", line 672, in emit
    self.socket.sendto(msg, self.address)
TypeError: sendto() takes exactly 3 arguments (2 given)

The issue is fixed simply by adding some sort of encoding coercion
before the sendto, for example:

if type(msg)==unicode: msg=msg.encode('utf-8')

components: Library (Lib)
messages: 93694
nosy: rszefler
severity: normal
status: open
title: SysLogHandler can't handle Unicode
type: behavior
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list