From 5189047f97ea99f0d88a5142685ae48f20d90dfe Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Mon, 7 Oct 2019 18:08:56 +0000 Subject: [PATCH] download_from_google_storage: Decode string passed to re.search() The code in _downloader_worker_thread() does not work with Python 3: Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/home/rakuco/src/depot_tools/download_from_google_storage.py", line 343, in _downloader_worker_thread elif re.search(r'executable:\s*1', out): File "/usr/lib/python3.7/re.py", line 183, in search return _compile(pattern, flags).search(string) TypeError: cannot use a string pattern on a bytes-like object Bug: 984182, 1007872 Change-Id: I09df8169d802b010596ac4f34501b4bda805e6f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1844833 Auto-Submit: Raphael Kubo da Costa Commit-Queue: Edward Lesmes Reviewed-by: Edward Lesmes --- download_from_google_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download_from_google_storage.py b/download_from_google_storage.py index 498882d39..067f772ae 100755 --- a/download_from_google_storage.py +++ b/download_from_google_storage.py @@ -340,7 +340,7 @@ def _downloader_worker_thread(thread_num, q, force, base_url, if code != 0: out_q.put('%d> %s' % (thread_num, err.decode())) ret_codes.put((code, err.decode())) - elif re.search(r'executable:\s*1', out): + elif re.search(r'executable:\s*1', out.decode()): st = os.stat(output_filename) os.chmod(output_filename, st.st_mode | stat.S_IEXEC)