Add some debug print when the filename could not be guessed
authorAntonio Ospite <ospite@studenti.unina.it>
Mon, 19 Sep 2011 10:13:29 +0000 (12:13 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Mon, 19 Sep 2011 10:13:29 +0000 (12:13 +0200)
winfreed.py

index c465b63..b9da36e 100755 (executable)
@@ -59,10 +59,15 @@ def download(entry):
 
     response = urllib2.urlopen(url)
     filename = urllib2.unquote(os.path.basename(response.geturl()))
 
     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):
     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
         return
+
     outfile = open(destfile, mode='w')
 
     total_size = response.info().getheader('Content-Length').strip()
     outfile = open(destfile, mode='w')
 
     total_size = response.info().getheader('Content-Length').strip()