From 1bb6abfd81a26f8b151d985ab4b9c320cc89db5c Mon Sep 17 00:00:00 2001 From: Stefan Lau Date: Fri, 12 Jun 2015 13:04:59 +0200 Subject: Fix #181: Write to stdout.buffer in python3 instead of stdout. --- fs/utils.py | 4 ++-- 1 file 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() - -- cgit v1.2.1