From 149a6fcc0dbce28429ebd04645764872db3076d4 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 20 Oct 2020 16:23:44 +0100 Subject: [PATCH] MEMFS: no need to use binary mode for output --- memfs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/memfs.py b/memfs.py index a2bb7c774..0dc951130 100755 --- a/memfs.py +++ b/memfs.py @@ -69,7 +69,7 @@ for directory in dirs: fcount += 1 opath = get_outfile_name(output_file_base, fcount) print("MEMFS: Generating output:", opath) - buffer = open(opath, 'wb') + buffer = open(opath, "w") full = "%s/%s" % (dirpath, name) _, ext = os.path.splitext(full) @@ -89,7 +89,7 @@ for directory in dirs: SIZES[name] = os.path.getsize(full) txt = "const unsigned char %s[] = {" % (name,) - buffer.write(txt.encode()) + buffer.write(txt) with open(full, "rb") as f: i = 0 @@ -104,12 +104,12 @@ for directory in dirs: for n in range(0, len(contents_hex), 2): twoChars = ascii(contents_hex[n : n + 2]) txt = "0x%s," % (twoChars,) - buffer.write(txt.encode()) + buffer.write(txt) i += 1 if (i % 20) == 0: - buffer.write("\n".encode()) + buffer.write("\n") - buffer.write("};\n".encode()) + buffer.write("};\n") if buffer.tell() >= CHUNK: buffer.close() buffer = None