From: Antonio Ospite Date: Mon, 19 Sep 2011 10:13:29 +0000 (+0200) Subject: Add some debug print when the filename could not be guessed X-Git-Url: https://git.ao2.it/winfreed.git/commitdiff_plain/ff826320ca4a4d2bbd17a4aac0c307840941a75c?ds=sidebyside Add some debug print when the filename could not be guessed --- diff --git a/winfreed.py b/winfreed.py index c465b63..b9da36e 100755 --- a/winfreed.py +++ b/winfreed.py @@ -59,10 +59,15 @@ def download(entry): response = urllib2.urlopen(url) filename = urllib2.unquote(os.path.basename(response.geturl())) + if filename == "": + sys.stderr.write("Debug (%s): filename: %s url: %s\n" %(entry['package'], filename, response.geturl())) + return + destfile = os.path.join(OUTPUT_DIR, filename) if os.path.exists(destfile): - sys.stderr.write("Warning: %s exists!\n" % destfile) + sys.stderr.write("Warning (%s): %s exists!\n" % (entry['package'], destfile)) return + outfile = open(destfile, mode='w') total_size = response.info().getheader('Content-Length').strip()