ugh, corrupt downloads. when did this break?

This commit is contained in:
George Hotz 2020-11-07 08:04:43 -08:00
parent 9332fe1989
commit ce0c80e1bd
1 changed files with 3 additions and 1 deletions

View File

@ -16,9 +16,11 @@ def fetch(url):
with open(fp, "rb") as f:
dat = f.read()
else:
with open(fp, "wb") as f:
print("fetching %s" % url)
with open(fp+".tmp", "wb") as f:
dat = requests.get(url).content
f.write(dat)
os.rename(fp+".tmp", fp)
return dat
def fetch_mnist():