diff options
| author | robot-piglet <[email protected]> | 2024-06-06 06:56:20 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2024-06-06 07:06:13 +0300 |
| commit | f44820822073337ca895dee0ce177e5cf40260df (patch) | |
| tree | 488bb2442f0d7f8cbfeaf6f0c9afe268135e8f99 /library/python/fs | |
| parent | f461772a29a6d4d1c1b4890a3c8c9e0384b72769 (diff) | |
Intermediate changes
Diffstat (limited to 'library/python/fs')
| -rw-r--r-- | library/python/fs/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/python/fs/__init__.py b/library/python/fs/__init__.py index 86391afbe9b..6b6a011e7fe 100644 --- a/library/python/fs/__init__.py +++ b/library/python/fs/__init__.py @@ -290,7 +290,10 @@ def copy_tree(src, dst, copy_function=shutil.copy2): # Throws OSError @errorfix_win def read_file(path, binary=True): - with open(path, 'r' + ('b' if binary else '')) as f: + kwargs = {} + if not binary and six.PY3: + kwargs['encoding'] = sys.getfilesystemencoding() + with open(path, 'r' + ('b' if binary else ''), **kwargs) as f: return f.read() |
