aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIavor-Valentin Iftime <valiiftime@google.com>2022-02-09 15:56:14 +0000
committerIavor-Valentin Iftime <valiiftime@google.com>2022-02-09 16:02:33 +0000
commit756b56125ae2d4b30d056d2ae8d0818ae2f0d656 (patch)
tree48246af443bf4e504a4b6409e37f492eb1f2e673
parent6daac9c78ddbd516abe551029edcaeda3fab90a0 (diff)
downloadbuild-756b56125ae2d4b30d056d2ae8d0818ae2f0d656.tar.gz
Fix python3 errors: "TypeError: write() argument must be str, not bytes"
Bug: 186097910 Change-Id: I191c3230596026ee327c1403a6c72fbfa6fdb2d9
-rw-r--r--tools/releasetools/add_img_to_target_files.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 9a9fba148d..7143775333 100644
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -170,16 +170,16 @@ def AddVendor(output_zip, recovery_img=None, boot_img=None):
return img.name
def output_sink(fn, data):
- ofile = open(os.path.join(OPTIONS.input_tmp, "VENDOR", fn), "w")
- ofile.write(data)
- ofile.close()
+ output_file = os.path.join(OPTIONS.input_tmp, "VENDOR", fn)
+ with open(output_file, "wb") as ofile:
+ ofile.write(data)
if output_zip:
arc_name = "VENDOR/" + fn
if arc_name in output_zip.namelist():
OPTIONS.replace_updated_files_list.append(arc_name)
else:
- common.ZipWrite(output_zip, ofile.name, arc_name)
+ common.ZipWrite(output_zip, output_file, arc_name)
board_uses_vendorimage = OPTIONS.info_dict.get(
"board_uses_vendorimage") == "true"