From 1ae5e0afe657c194599047207baa8c925693d1c3 Mon Sep 17 00:00:00 2001 From: "Aleskarova, Dinara" Date: Thu, 20 Apr 2017 09:58:25 +0400 Subject: [PATCH] Checking output line and encoding it if it is Unicode --- src/flake8/formatting/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py index abad254..180380a 100644 --- a/src/flake8/formatting/base.py +++ b/src/flake8/formatting/base.py @@ -166,6 +166,8 @@ class BaseFormatter(object): def _write(self, output): """Handle logic of whether to use an output file or print().""" + if not isinstance(output, str): + output = output.encode('UTF-8') if self.output_fd is not None: self.output_fd.write(output + self.newline) if self.output_fd is None or self.options.tee: