From 39f8e222d98465fede4fd3ff208e17329902fe75 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 25 Jul 2016 23:47:39 +0300 Subject: [PATCH] lib/python/init.py: simplify excepthook using ColoredFile --- lib/python/init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/python/init.py b/lib/python/init.py index 0e33d09..6a6ff9a 100644 --- a/lib/python/init.py +++ b/lib/python/init.py @@ -175,9 +175,9 @@ def init(): def excepthook(etype, evalue, etraceback): lines = format_exception(etype, evalue, etraceback) pager = Pager() + pager.stdout = ColoredFile(pager.stdout, '\033[31m') # red for line in lines: - pager.write( - '\033[31m' + line.rstrip('\n') + '\033[0m\n') # red, reset + pager.write(line) pager.close() sys.excepthook = excepthook -- 2.39.5