diff options
author | prettyboy <prettyboy@yandex-team.com> | 2024-02-21 17:29:59 +0300 |
---|---|---|
committer | prettyboy <prettyboy@yandex-team.com> | 2024-02-21 17:42:12 +0300 |
commit | 21457097d28e0881bf02630316248eb5060cbd42 (patch) | |
tree | 24917478b8f9f9432a7aa2b5f94ecbd0efd9b2bc /build/scripts/cat.py | |
parent | 97a40dc494ba69c0b2f7f337757f18dfe8db1282 (diff) | |
download | ydb-21457097d28e0881bf02630316248eb5060cbd42.tar.gz |
[build/scripts/cat.py] Fixed py23 compat
Фикс для https://a.yandex-team.ru/review/5393734/details#comment--6406734
dec6fcab69f58174dec7b4bf87942e894196f77e
Diffstat (limited to 'build/scripts/cat.py')
-rwxr-xr-x | build/scripts/cat.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/build/scripts/cat.py b/build/scripts/cat.py index 0c3f73d96f..875050cac6 100755 --- a/build/scripts/cat.py +++ b/build/scripts/cat.py @@ -3,13 +3,17 @@ import sys from shutil import copyfileobj as copy import os.path + +PY3 = sys.version_info[0] == 3 + + if __name__ == '__main__': for filename in sys.argv[1:] or ["-"]: if filename == "-": copy(sys.stdin, sys.stdout) else: if os.path.exists(filename): - with open(filename, 'rb') as file: + with open(filename, 'r' if PY3 else 'rb') as file: copy(file, sys.stdout) else: sys.stderr.write('cat.py: {0}: No such file or directory\n'.format(filename)) |