From 7a353d2e23ed336cea41a05a03732a35e45801c2 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 8 Sep 2021 17:10:04 -0400 Subject: write directly to sys.stdout.buffer to avoid windows io encoding --- src/flake8/formatting/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/flake8/formatting/base.py') diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py index 806d9b8..7919f92 100644 --- a/src/flake8/formatting/base.py +++ b/src/flake8/formatting/base.py @@ -1,6 +1,7 @@ """The base class and interface for all formatting plugins.""" import argparse import os +import sys from typing import IO from typing import List from typing import Optional @@ -183,7 +184,7 @@ class BaseFormatter: if self.output_fd is not None: self.output_fd.write(output + self.newline) if self.output_fd is None or self.options.tee: - print(output, end=self.newline) + sys.stdout.buffer.write(output.encode() + self.newline.encode()) def write(self, line: Optional[str], source: Optional[str]) -> None: """Write the line either to the output file or stdout. -- cgit v1.2.1