From 186a52ca019c3ddddde6eb106aa07aaec11babfd Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 12 Mar 2019 20:44:00 +1100 Subject: [PATCH] Retry on URLError --- winbuild/fetch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/winbuild/fetch.py b/winbuild/fetch.py index b7acb63ac..830a64ee5 100644 --- a/winbuild/fetch.py +++ b/winbuild/fetch.py @@ -9,7 +9,11 @@ def fetch(url): if not os.path.exists(name): print("Fetching", url) - content = urllib.request.urlopen(url).read() + try: + r = urllib.request.urlopen(url) + except urllib.error.URLError: + r = urllib.request.urlopen(url) + content = r.read() with open(name, 'wb') as fd: fd.write(content) return name