From 10ac916beb21931c505c2ad04ab175e5c5da8f96 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Sat, 24 Oct 2020 13:33:40 -0400 Subject: [PATCH] Fix closurebuilder.py for Python 3 Currently closurebuilder.py throws this when run in Python 3: ``` Traceback (most recent call last): File "third-party-downloads/build/closurebuilder.py", line 300, in main() File "third-party-downloads/build/closurebuilder.py", line 260, in main out.writelines([js_source.GetPath() + '\n' for js_source in deps]) TypeError: a bytes-like object is required, not 'str' ``` Writing to `sys.stdout` rather than `sys.stdout.buffer` fixes this. Reported at https://github.com/google/blockly-games/issues/195#issuecomment-715958020 --- closure/bin/build/closurebuilder.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/closure/bin/build/closurebuilder.py b/closure/bin/build/closurebuilder.py index cb6ebc0432..16b6167e27 100755 --- a/closure/bin/build/closurebuilder.py +++ b/closure/bin/build/closurebuilder.py @@ -209,12 +209,7 @@ def main(): if options.output_file: out = io.open(options.output_file, 'wb') else: - version = sys.version_info[:2] - if version >= (3, 0): - # Write bytes to stdout - out = sys.stdout.buffer - else: - out = sys.stdout + out = sys.stdout sources = set()