diff options
author | Timothy Edmund Crosley <timothy.crosley@gmail.com> | 2019-04-14 11:09:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-14 11:09:45 -0700 |
commit | 05c3592dd61af2bce67306097a057f8c7f0a69f2 (patch) | |
tree | 723755c1fc57a239693c83849a330c511a17e217 /isort/isort.py | |
parent | 7f0363429a633df2c53cfbb9beae0360e27acd75 (diff) | |
parent | c8ef839417516032c45bc48d4d041aa04aafae0d (diff) | |
download | isort-05c3592dd61af2bce67306097a057f8c7f0a69f2.tar.gz |
Merge pull request #925 from Cluas/fix-python2-stdout-write-unicode-error
Fix: "isort -" will raise UnicodeEncodeError on python2.
Diffstat (limited to 'isort/isort.py')
-rw-r--r-- | isort/isort.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/isort/isort.py b/isort/isort.py index 7ae539d5..991aed51 100644 --- a/isort/isort.py +++ b/isort/isort.py @@ -236,6 +236,8 @@ class SortImports(object): if show_diff or self.config['show_diff']: self._show_diff(file_contents) elif write_to_stdout: + if sys.version_info[0] < 3: + self.output = self.output.encode(self.file_encoding) sys.stdout.write(self.output) elif file_name and not check: if self.output == file_contents: |