Removed unnecessary comments and added more information at exception handling in downloader.py

This commit is contained in:
Samer Afach 2016-11-13 00:04:42 +01:00
parent 3f9681b621
commit 39813cb355
3 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,6 @@ if __name__ == '__main__':
while True: while True:
file_lines = list(islice(infile, args.numlines)) file_lines = list(islice(infile, args.numlines))
if len(file_lines) > 0: if len(file_lines) > 0:
print(file_lines)
listdownloader.download_files(file_lines, args.dest, args.threads) listdownloader.download_files(file_lines, args.dest, args.threads)
else: else:
break break

View File

@ -111,8 +111,9 @@ def download_file(url, to_dir):
ext = info.get_content_subtype() ext = info.get_content_subtype()
if len(file_name) < len(ext) or file_name[-len(ext):] != ext: # add file extension if not present if len(file_name) < len(ext) or file_name[-len(ext):] != ext: # add file extension if not present
file_name += "." + ext file_name += "." + ext
except urllib.error.URLError: except urllib.error.URLError as e:
sys.stderr.write("Skipping invalid URL, or possibly failed to get URL: " + url) sys.stderr.write("Skipping invalid URL, or possibly failed to get URL: " + url
+ "\nError message: " + str(e) + "\n")
return return
target_path = os.path.join(to_dir, file_name) target_path = os.path.join(to_dir, file_name)

View File

@ -5,7 +5,7 @@ del os.link
setup( setup(
name="listdownloader", name="listdownloader",
version="0.1.0", version="0.1.3",
author="Samer Afach", author="Samer Afach",
author_email="samer@afach.de", author_email="samer@afach.de",
packages=["listdownloader"], packages=["listdownloader"],