File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ def downloadFile(urls, path: str):
60
60
with open (path , 'wb' ) as file :
61
61
for url in urls :
62
62
startPosition = file .tell ()
63
+ success = False
63
64
for attempt in range (8 ):
64
65
print (f'📄 { url } (attempt: { attempt } )' )
65
66
try :
@@ -74,12 +75,15 @@ def downloadFile(urls, path: str):
74
75
sys .stdout .write ("\r Downloaded %i MB" % sizeMb )
75
76
lastSizeMb = sizeMb
76
77
sys .stdout .write ('\n ' )
78
+ success = True
77
79
break
78
80
except Exception as e :
79
81
print (f'\n ❌ Error downloading { url } : { e } ' )
80
82
file .seek (startPosition )
81
83
file .truncate ()
82
84
time .sleep (1 * attempt )
85
+ if not success :
86
+ raise Exception (f'Failed to download { url } ' )
83
87
sys .stdout .write (' ✅\n ' )
84
88
85
89
def download (modelName : str , model : list ):
You can’t perform that action at this time.
0 commit comments