Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Fix closurebuilder.py for Python 3
Browse files Browse the repository at this point in the history
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 <module>
    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 google/blockly-games#195 (comment)
  • Loading branch information
NeilFraser authored and shicks committed Nov 10, 2020
1 parent 89d98af commit 4c90818
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions closure/bin/build/closurebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 4c90818

Please sign in to comment.