From 39813cb3558b92ab37841b008652b33cc4fc347b Mon Sep 17 00:00:00 2001 From: Samer Afach Date: Sun, 13 Nov 2016 00:04:42 +0100 Subject: [PATCH] Removed unnecessary comments and added more information at exception handling in downloader.py --- bin/downloadlist.py | 1 - listdownloader/downloader.py | 5 +++-- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/downloadlist.py b/bin/downloadlist.py index caa7b34..54b35f2 100644 --- a/bin/downloadlist.py +++ b/bin/downloadlist.py @@ -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 diff --git a/listdownloader/downloader.py b/listdownloader/downloader.py index 17b3258..a87f2b6 100644 --- a/listdownloader/downloader.py +++ b/listdownloader/downloader.py @@ -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) diff --git a/setup.py b/setup.py index e62a725..2014b45 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ del os.link setup( name="listdownloader", - version="0.1.0", + version="0.1.3", author="Samer Afach", author_email="samer@afach.de", packages=["listdownloader"],