diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2021-03-05 12:32:19 -0500 |
---|---|---|
committer | Kelvin Zhang <zhangkelvin@google.com> | 2021-03-05 13:24:14 -0500 |
commit | 472d561934b997d9b8d6cdba41f5c2c493bb0bf1 (patch) | |
tree | 2a4966c91f0c099e16adc58583567dd2f073952e /scripts/update_device.py | |
parent | 5bd4622bd6e91e97355c5cc0a4c9dc439cc29779 (diff) |
Fix python3 compatibility issues
Python3 expects write() to accept bytes or str, depending on file type(w
or wb). Since zipfile returns bytes, we must open output file with "wb",
which is the default.
Test: python3 update_device.py some_ota.zip
Change-Id: I9f163341921d7681988ee1eb01e98f0ecd5e98c9
Diffstat (limited to 'scripts/update_device.py')
-rwxr-xr-x | scripts/update_device.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/update_device.py b/scripts/update_device.py index 348c3b70..430988cb 100755 --- a/scripts/update_device.py +++ b/scripts/update_device.py @@ -464,7 +464,7 @@ def main(): if CARE_MAP_ENTRY_NAME in zfp.namelist() and not args.no_care_map: # Need root permission to push to /data dut.adb(["root"]) - with tempfile.NamedTemporaryFile("w+") as care_map_fp: + with tempfile.NamedTemporaryFile() as care_map_fp: care_map_fp.write(zfp.read(CARE_MAP_ENTRY_NAME)) care_map_fp.flush() dut.adb(["push", care_map_fp.name, |