mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-03 23:43:40 +03:00
Retry on URLError
This commit is contained in:
parent
b3587f0fb7
commit
186a52ca01
|
@ -9,7 +9,11 @@ def fetch(url):
|
||||||
|
|
||||||
if not os.path.exists(name):
|
if not os.path.exists(name):
|
||||||
print("Fetching", url)
|
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:
|
with open(name, 'wb') as fd:
|
||||||
fd.write(content)
|
fd.write(content)
|
||||||
return name
|
return name
|
||||||
|
|
Loading…
Reference in New Issue
Block a user