◐ Shell
clean mode source ↗

Message 86198 - Python tracker

(python 2.6.2, WinXP)
logging to console stopped working. Here is a workaround:

logging/__init__.py:
class StreamHandler(Handler):
    ...
    def emit(self, record):
    ...
                    if (isinstance(msg, unicode) or
                        getattr(stream, 'encoding', None) is None):
-                         stream.write(fs % msg)
+                         if stream == sys.stdout:
+                             print(msg)
+                         else:
+                             stream.write(fs % msg)