From e225ef6ac51e95abad34119948b13a669bf031fc Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Mon, 7 Oct 2019 18:06:45 +0000 Subject: [PATCH] download_from_google_storage: Do not call decode() on a string twice This throws an exception when running 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 259, in _downloader_worker_thread file_url = '%s/%s' % (base_url, input_sha1_sum.decode()) AttributeError: 'str' object has no attribute 'decode' We are already calling bytes.decode() in enumerate_input(), whose output is passed to _downloader_worker_thread(). Bug: 984182, 1007872 Change-Id: I55c4835192caf69a8dee9e89ae1bb5531f4bacae Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1844832 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 7ea0829a4..498882d39 100755 --- a/download_from_google_storage.py +++ b/download_from_google_storage.py @@ -256,7 +256,7 @@ def _downloader_worker_thread(thread_num, q, force, base_url, if get_sha1(output_filename) == input_sha1_sum: continue # Check if file exists. - file_url = '%s/%s' % (base_url, input_sha1_sum.decode()) + file_url = '%s/%s' % (base_url, input_sha1_sum) (code, _, err) = gsutil.check_call('ls', file_url) if code != 0: if code == 404: