Skip to content

Commit 7a5e558

Browse files
authored
Merge pull request #366 from betzw/betzw_wb
Use 'urllib2' for retrieving mbed library
2 parents eeb4a87 + b9d67c9 commit 7a5e558

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mbed/mbed.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import errno
3030
from itertools import chain, izip, repeat
3131
from urlparse import urlparse
32-
import urllib
32+
import urllib2
3333
import zipfile
3434
import argparse
3535

@@ -281,7 +281,10 @@ def fetch_rev(url, rev):
281281
try:
282282
if not os.path.exists(tmp_file):
283283
action("Downloading mbed library build \"%s\" (might take a minute)" % rev)
284-
urllib.urlretrieve(url, tmp_file)
284+
outfd = open(tmp_file, 'wb')
285+
inurl = urllib2.urlopen(url)
286+
outfd.write(inurl.read())
287+
outfd.close()
285288
except:
286289
if os.path.isfile(tmp_file):
287290
os.remove(tmp_file)
@@ -2425,4 +2428,4 @@ def main():
24252428

24262429

24272430
if __name__ == "__main__":
2428-
main()
2431+
main()

0 commit comments

Comments
 (0)