Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix downloading of Mbed 2 when zip is too big #857

Merged
merged 2 commits into from
Mar 4, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mbed/mbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,13 @@ def fetch_rev(url, rev):
try:
if not os.path.exists(rev_file):
action("Downloading library build \"%s\" (might take a while)" % rev)
outfd = open(rev_file, 'wb')
inurl = urlopen(url)
outfd.write(inurl.read())
outfd.close()
with open(rev_file, 'wb') as outfd:
data = None
while data != '':
# Download and write the data in 1 MB chunks
data = inurl.read(1024 * 1024)
outfd.write(data)
except:
bridadan marked this conversation as resolved.
Show resolved Hide resolved
if os.path.isfile(rev_file):
os.remove(rev_file)
Expand Down