summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Lau <github@stefanlau.com>2015-06-12 13:04:59 +0200
committerStefan Lau <github@stefanlau.com>2015-06-12 14:03:45 +0200
commit1bb6abfd81a26f8b151d985ab4b9c320cc89db5c (patch)
tree382119a81dea92516455b0b1fddc5533e1247ae7
parent1efaf2b2fe6821808e8983ae441a963b7a6b3db2 (diff)
downloadpyfilesystem-git-1bb6abfd81a26f8b151d985ab4b9c320cc89db5c.tar.gz
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()
-