mirror of
https://github.com/servo/servo.git
synced 2025-06-14 11:24:33 +00:00
Auto merge of #25617 - zhuowei:python3-bootstrap-android, r=jdm
mach: fix `bootstrap-android` on Python 3 When running `python3 ./mach bootstrap-android`, this error occurs: ``` AttributeError: 'HTTPMessage' object has no attribute 'getheader' File "/servo/python/servo/bootstrap_commands.py", line 136, in bootstrap_android download("sdk", tools.format(system=system)) File "/servo/python/servo/bootstrap_commands.py", line 117, in download download_file(filename, url, archive) File "/servo/python/servo/util.py", line 170, in download_file download(desc, src, fd) File "/servo/python/servo/util.py", line 110, in download if resp.info().getheader('Content-Length'): ``` Use the `get()` function instead, which exists in both Python 3 and 2 (where it is a synonym for `getheader()`). Fixes #25616.
This commit is contained in:
commit
f75b01f07d
1 changed files with 2 additions and 2 deletions
|
@ -107,8 +107,8 @@ def download(desc, src, writer, start_byte=0):
|
|||
resp = urllib.request.urlopen(req, **get_urlopen_kwargs())
|
||||
|
||||
fsize = None
|
||||
if resp.info().getheader('Content-Length'):
|
||||
fsize = int(resp.info().getheader('Content-Length').strip()) + start_byte
|
||||
if resp.info().get('Content-Length'):
|
||||
fsize = int(resp.info().get('Content-Length').strip()) + start_byte
|
||||
|
||||
recved = start_byte
|
||||
chunk_size = 64 * 1024
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue