summaryrefslogtreecommitdiff
path: root/src/flake8/formatting/base.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2021-09-08 17:10:04 -0400
committerAnthony Sottile <asottile@umich.edu>2021-09-08 17:10:04 -0400
commit7a353d2e23ed336cea41a05a03732a35e45801c2 (patch)
tree12018453b0c6ee98999573f4b2982a3d5a41dddb /src/flake8/formatting/base.py
parent62cf28bf091826008796105f93231438af93a534 (diff)
downloadflake8-7a353d2e23ed336cea41a05a03732a35e45801c2.tar.gz
write directly to sys.stdout.buffer to avoid windows io encoding
Diffstat (limited to 'src/flake8/formatting/base.py')
-rw-r--r--src/flake8/formatting/base.py3
1 files changed, 2 insertions, 1 deletions
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.