Commit
·
3fcd365
1
Parent(s):
fe5b3f8
Fix curl download on Windows (#669)
Browse files- utils/google_utils.py +1 -3
utils/google_utils.py
CHANGED
@@ -50,8 +50,7 @@ def gdrive_download(id='1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', name='coco128.zip'):
|
|
50 |
out = "NUL" if platform.system() == "Windows" else "/dev/null"
|
51 |
os.system('curl -c ./cookie -s -L "drive.google.com/uc?export=download&id=%s" > %s ' % (id, out))
|
52 |
if os.path.exists('cookie'): # large file
|
53 |
-
s = 'curl -Lb ./cookie "drive.google.com/uc?export=download&confirm=%s&id=%s" -o %s' % (
|
54 |
-
get_token(), id, name)
|
55 |
else: # small file
|
56 |
s = 'curl -s -L -o %s "drive.google.com/uc?export=download&id=%s"' % (name, id)
|
57 |
r = os.system(s) # execute, capture return values
|
@@ -80,7 +79,6 @@ def get_token(cookie="./cookie"):
|
|
80 |
return line.split()[-1]
|
81 |
return ""
|
82 |
|
83 |
-
|
84 |
# def upload_blob(bucket_name, source_file_name, destination_blob_name):
|
85 |
# # Uploads a file to a bucket
|
86 |
# # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python
|
|
|
50 |
out = "NUL" if platform.system() == "Windows" else "/dev/null"
|
51 |
os.system('curl -c ./cookie -s -L "drive.google.com/uc?export=download&id=%s" > %s ' % (id, out))
|
52 |
if os.path.exists('cookie'): # large file
|
53 |
+
s = 'curl -Lb ./cookie "drive.google.com/uc?export=download&confirm=%s&id=%s" -o %s' % (get_token(), id, name)
|
|
|
54 |
else: # small file
|
55 |
s = 'curl -s -L -o %s "drive.google.com/uc?export=download&id=%s"' % (name, id)
|
56 |
r = os.system(s) # execute, capture return values
|
|
|
79 |
return line.split()[-1]
|
80 |
return ""
|
81 |
|
|
|
82 |
# def upload_blob(bucket_name, source_file_name, destination_blob_name):
|
83 |
# # Uploads a file to a bucket
|
84 |
# # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python
|