提交 3fcd365b authored 作者: Glenn Jocher's avatar Glenn Jocher

Fix curl download on Windows (#669)

上级 fe5b3f87
...@@ -50,8 +50,7 @@ def gdrive_download(id='1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', name='coco128.zip'): ...@@ -50,8 +50,7 @@ def gdrive_download(id='1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', name='coco128.zip'):
out = "NUL" if platform.system() == "Windows" else "/dev/null" out = "NUL" if platform.system() == "Windows" else "/dev/null"
os.system('curl -c ./cookie -s -L "drive.google.com/uc?export=download&id=%s" > %s ' % (id, out)) os.system('curl -c ./cookie -s -L "drive.google.com/uc?export=download&id=%s" > %s ' % (id, out))
if os.path.exists('cookie'): # large file if os.path.exists('cookie'): # large file
s = 'curl -Lb ./cookie "drive.google.com/uc?export=download&confirm=%s&id=%s" -o %s' % ( s = 'curl -Lb ./cookie "drive.google.com/uc?export=download&confirm=%s&id=%s" -o %s' % (get_token(), id, name)
get_token(), id, name)
else: # small file else: # small file
s = 'curl -s -L -o %s "drive.google.com/uc?export=download&id=%s"' % (name, id) s = 'curl -s -L -o %s "drive.google.com/uc?export=download&id=%s"' % (name, id)
r = os.system(s) # execute, capture return values r = os.system(s) # execute, capture return values
...@@ -80,7 +79,6 @@ def get_token(cookie="./cookie"): ...@@ -80,7 +79,6 @@ def get_token(cookie="./cookie"):
return line.split()[-1] return line.split()[-1]
return "" return ""
# def upload_blob(bucket_name, source_file_name, destination_blob_name): # def upload_blob(bucket_name, source_file_name, destination_blob_name):
# # Uploads a file to a bucket # # Uploads a file to a bucket
# # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python # # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论