Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #194 -- use io.open for Python 2 support
- Loading branch information
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c5b814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 3.x doesn't support encoding argument with files opened in "binary" mode. Documentation of io.open says:
encoding is the name of the encoding used to decode or encode the file. This should only be used in text mode.
c5b814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess removing the
b
should do the job, then? I don't see why it should have been there in the first place, anyway.c5b814a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tested the same by doing it and it worked. I am not sure if all the cases would be covered by just removing the 'b'. Later in line: 106, the content could be a unicode string, which might need some more special handling to keep things from breaking.