minor bug fix, changed timeout, avoid broken files
[comic-widget] / src / usr / lib / hildon-desktop / comicwidget.py
index 950bd5f..01fa400 100644 (file)
@@ -12,6 +12,9 @@ import cairo
 import datetime
 import shutil
 import sys
+import socket
+
+socket.setdefaulttimeout(10)
 
 supports_alpha = False
 
@@ -22,7 +25,7 @@ supports_alpha = False
 
 # constants. dbfile is the location of the csv
 # comiccache is the location of the images
-APP_VERSION = "0.3.4-1"
+APP_VERSION = "0.3.4-2"
 
 basedbdir = "/opt/comic-widget/db/"
 imagedir = "/opt/comic-widget/images/"
@@ -137,7 +140,12 @@ class ComicDb():
                                        print "created dir"
                                except:
                                        print "comic db creation failed on mkdir"
-                       urllib.urlretrieve(dbrow['url'], filename)
+                       try:
+
+                               urllib.urlretrieve(dbrow['url'], filename)
+                       except:
+                               if os.path.isfile(filename):
+                                       os.remove(filename)
                        print "success\n"
                        return filename