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

Fix closurebuilder.py for Python 3 #1092

Closed
wants to merge 1 commit into from
Closed

Fix closurebuilder.py for Python 3 #1092

wants to merge 1 commit into from

Conversation

NeilFraser
Copy link
Contributor

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)
Related to #849, but that issue failed to actually modify closurebuilder.py

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)
@12wrigja
Copy link
Collaborator

12wrigja commented Nov 3, 2020

Thanks Neil. I'm surprised that the existing code doesn't work.

Merging this shortly.

shicks added a commit that referenced this pull request Nov 10, 2020
PiperOrigin-RevId: 340552063
@shicks shicks closed this Nov 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants