diff options
author | Mathieu Bridon <[email protected]> | 2018-06-26 08:52:08 +0200 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2018-08-01 14:26:19 +0100 |
commit | c24d82696867da13360f23abecf130e839da8b0f (patch) | |
tree | 5d758708633868915341c95da42c5c98c49d5809 /src | |
parent | e40200e0aa14ec4180dd090dd37a2de80b5e4119 (diff) |
python: Open file in binary mode
The XML parser wants byte strings, not unicode strings.
In both Python 2 and 3, opening a file without specifying the mode will
open it for reading in text mode ('r').
On Python 2, the read() method of the file object will return byte
strings, while on Python 3 it will return unicode strings.
Explicitly specifying the binary mode ('rb') makes the behaviour
identical in both Python 2 and 3, returning what the XML parser
expects.
Signed-off-by: Mathieu Bridon <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/genxml/gen_bits_header.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py index e31e9ff1035..dcd6ccb7d9e 100644 --- a/src/intel/genxml/gen_bits_header.py +++ b/src/intel/genxml/gen_bits_header.py @@ -282,7 +282,7 @@ class XmlParser(object): self.container = None def parse(self, filename): - with open(filename) as f: + with open(filename, 'rb') as f: self.parser.ParseFile(f) def start_element(self, name, attrs): |