Removed unnecessary comments and added more information at exception handling in downloader.py
This commit is contained in:
parent
3f9681b621
commit
39813cb355
@ -27,7 +27,6 @@ if __name__ == '__main__':
|
||||
while True:
|
||||
file_lines = list(islice(infile, args.numlines))
|
||||
if len(file_lines) > 0:
|
||||
print(file_lines)
|
||||
listdownloader.download_files(file_lines, args.dest, args.threads)
|
||||
else:
|
||||
break
|
||||
|
@ -111,8 +111,9 @@ def download_file(url, to_dir):
|
||||
ext = info.get_content_subtype()
|
||||
if len(file_name) < len(ext) or file_name[-len(ext):] != ext: # add file extension if not present
|
||||
file_name += "." + ext
|
||||
except urllib.error.URLError:
|
||||
sys.stderr.write("Skipping invalid URL, or possibly failed to get URL: " + url)
|
||||
except urllib.error.URLError as e:
|
||||
sys.stderr.write("Skipping invalid URL, or possibly failed to get URL: " + url
|
||||
+ "\nError message: " + str(e) + "\n")
|
||||
return
|
||||
|
||||
target_path = os.path.join(to_dir, file_name)
|
||||
|
Loading…
Reference in New Issue
Block a user