From d6db1d0b81211a80884131b10212195ab38f99ad Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Sun, 20 Mar 2016 23:55:32 +0100 Subject: [PATCH] Fix a conflict with IPython. --- dosagelib/output.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dosagelib/output.py b/dosagelib/output.py index 22df9e066..4c278329b 100644 --- a/dosagelib/output.py +++ b/dosagelib/output.py @@ -1,6 +1,8 @@ -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam +# Copyright (C) 2005-2016 Tobias Gruetzmacher + import time import sys import os @@ -9,8 +11,10 @@ import traceback import codecs from .ansicolor import Colorizer + lock = threading.Lock() + def get_threadname(): """Return name of current thread.""" return threading.current_thread().getName() @@ -29,7 +33,7 @@ class Output(object): self.encoding = sys.stdout.encoding else: self.encoding = 'utf-8' - if sys.version_info[0] >= 3: + if hasattr(sys.stdout, 'buffer'): stream = sys.stdout.buffer else: stream = sys.stdout @@ -55,8 +59,6 @@ class Output(object): def error(self, s, tb=None): """Write an error message.""" self.write(u"ERROR: %s" % s, color='light;red') - #if tb is not None: - # self.write('Traceback (most recent call last):', 1) def exception(self, s): """Write error message with traceback info."""