We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e69923c + 93a0a04 commit 6be14daCopy full SHA for 6be14da
mbed/mbed.py
@@ -389,11 +389,14 @@ def fetch_rev(url, rev):
389
try:
390
if not os.path.exists(rev_file):
391
action("Downloading library build \"%s\" (might take a while)" % rev)
392
- outfd = open(rev_file, 'wb')
393
inurl = urlopen(url)
394
- outfd.write(inurl.read())
395
- outfd.close()
396
- except:
+ with open(rev_file, 'wb') as outfd:
+ data = None
+ while data != '':
+ # Download and write the data in 1 MB chunks
397
+ data = inurl.read(1024 * 1024)
398
+ outfd.write(data)
399
+ except Exception:
400
if os.path.isfile(rev_file):
401
os.remove(rev_file)
402
raise Exception(128, "Download failed!\nPlease try again later.")
0 commit comments