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

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

View File

@@ -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)