summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill McGugan <willmcgugan@gmail.com>2015-11-13 22:36:41 +0000
committerWill McGugan <willmcgugan@gmail.com>2015-11-13 22:36:41 +0000
commit959be2d7cfbe416df5e5c3648e0867e073574e91 (patch)
tree44cb5cbfc63b69f02375c1ef3b2b386a8abd47a2
parent5217ef014a2d31d9597f9a088e854bb4cb44f20a (diff)
parent1bb6abfd81a26f8b151d985ab4b9c320cc89db5c (diff)
downloadpyfilesystem-git-959be2d7cfbe416df5e5c3648e0867e073574e91.tar.gz
Merge pull request #205 from selaux/fix-tree-to-stdout-with-python-3
Fix #181: Write to stdout.buffer in python3 instead of stdout.
-rw-r--r--fs/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/utils.py b/fs/utils.py
index 208fc61..2326bca 100644
--- a/fs/utils.py
+++ b/fs/utils.py
@@ -23,6 +23,7 @@ import os
import sys
import stat
import six
+from six import PY3
from fs.mountfs import MountFS
from fs.path import pathjoin
@@ -532,7 +533,7 @@ def print_fs(fs,
"""
if file_out is None:
- file_out = sys.stdout
+ file_out = sys.stdout.buffer if PY3 else sys.stdout
file_encoding = getattr(file_out, 'encoding', 'utf-8') or 'utf-8'
file_encoding = file_encoding.upper()
@@ -687,4 +688,3 @@ if __name__ == "__main__":
print t2.listdir()
t1.tree()
t2.tree()
-