Skip to content

Commit edbb89f

Browse files
lorcjforissier
authored andcommitted
gen_hashed_bin.py: open file in binary mode
By default Python tries to open files in text mode. This is okay for python2, because it uses 8-bit encoding. But python3 tries to decode file as utf-8 encoded and fails, because it is a binary file. Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
1 parent 7d887fc commit edbb89f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/gen_hashed_bin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def append_to(outf, start_offs, in_fname, max_bytes=0xffffffff):
6767
def append_hashes(outf, in_fname):
6868
page_size = 4 * 1024
6969

70-
inf = open(in_fname, 'r')
70+
inf = open(in_fname, 'rb')
7171
while True:
7272
page = inf.read(page_size)
7373
if len(page) == page_size:

0 commit comments

Comments
 (0)