Skip to content

Commit 959be2d

Browse files
committed
Merge pull request #205 from selaux/fix-tree-to-stdout-with-python-3
Fix #181: Write to stdout.buffer in python3 instead of stdout.
2 parents 5217ef0 + 1bb6abf commit 959be2d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import sys
2424
import stat
2525
import six
26+
from six import PY3
2627

2728
from fs.mountfs import MountFS
2829
from fs.path import pathjoin
@@ -532,7 +533,7 @@ def print_fs(fs,
532533
"""
533534

534535
if file_out is None:
535-
file_out = sys.stdout
536+
file_out = sys.stdout.buffer if PY3 else sys.stdout
536537

537538
file_encoding = getattr(file_out, 'encoding', 'utf-8') or 'utf-8'
538539
file_encoding = file_encoding.upper()
@@ -687,4 +688,3 @@ def open_atomic_write(fs, path, mode='w'):
687688
print t2.listdir()
688689
t1.tree()
689690
t2.tree()
690-

0 commit comments

Comments
 (0)