update_engine: Fix paycheck script

The paycheck script was broken when migrating from python2 to python3.

BUG=chromium:1027199
TEST=tryjob, unittests

Change-Id: Ie40799138edbe6bdd49fb0bd5ab91ae6369e007f
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1929453
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/paycheck.py b/scripts/paycheck.py
index 3587750..f4ccca2 100755
--- a/scripts/paycheck.py
+++ b/scripts/paycheck.py
@@ -203,7 +203,7 @@
   # Parse and validate arguments.
   args = ParseArguments(argv[1:])
 
-  with open(args.payload) as payload_file:
+  with open(args.payload, 'rb') as payload_file:
     payload = update_payload.Payload(payload_file)
     try:
       # Initialize payload.
@@ -227,7 +227,7 @@
 
           part_sizes = (args.part_sizes and
                         dict(zip(args.part_names, args.part_sizes)))
-          metadata_sig_file = args.meta_sig and open(args.meta_sig)
+          metadata_sig_file = args.meta_sig and open(args.meta_sig, 'rb')
           payload.Check(
               pubkey_file_name=args.key,
               metadata_sig_file=metadata_sig_file,
@@ -258,7 +258,7 @@
         file_handles = []
         if args.out_dst_part_paths is not None:
           for name, path in zip(args.part_names, args.out_dst_part_paths):
-            handle = open(path, 'w+')
+            handle = open(path, 'wb+')
             file_handles.append(handle)
             out_dst_parts[name] = handle.name
         else: