@@ -57,30 +57,23 @@ def download_ligands_from_file(wget_file_path, LIGANDS_DIR):
57
57
with open (wget_file_path , 'r' ) as file :
58
58
for command in file :
59
59
command = command .strip ()
60
- if not command :
61
- continue
62
-
63
- # Set common wget options (all timeouts in seconds)
64
- wget_opts = "--timeout=60 --read-timeout=60 --tries=2 --waitretry=2"
65
-
66
- if '-O' in command :
67
- parts = command .split ('-O' )
68
- url = parts [0 ].strip ()
69
- filename = parts [1 ].strip ()
70
- full_output_path = os .path .join (LIGANDS_DIR , filename )
71
- final_command = f"wget { wget_opts } { url } -O { full_output_path } "
72
- else :
73
- final_command = f"{ command } { wget_opts } -P { LIGANDS_DIR } "
74
-
75
- print (f"Executing: { final_command } " )
76
- try :
60
+ if command :
61
+ if '-O' in command :
62
+ wget_options = '--timeout=2 --tries=3 '
63
+ parts = command .split ('-O' )
64
+ url = parts [0 ].strip ()
65
+ filename = parts [1 ].strip ()
66
+ full_output_path = os .path .join (LIGANDS_DIR , filename )
67
+ final_command = f"{ url } -O { full_output_path } { wget_options } "
68
+ else :
69
+ final_command = f"{ command } -P { LIGANDS_DIR } "
70
+
71
+ print (f"Executing: { final_command } " )
77
72
subprocess .run (final_command , shell = True , check = True )
78
- except subprocess .CalledProcessError :
79
- print (f"Warning: Failed to download with command: { final_command } " )
80
73
81
- print (f"All downloads attempted. Ligands stored in { LIGANDS_DIR } " )
82
- except Exception as e :
83
- print (f"Error during .wget file processing : { e } " )
74
+ print (f"All downloads completed and stored in { LIGANDS_DIR } " )
75
+ except subprocess . CalledProcessError as e :
76
+ print (f"Error during command execution : { e } " )
84
77
85
78
86
79
def main ():
0 commit comments