make sure the folder does not already exists
authorymh <ymh.work@gmail.com>
Fri, 29 Jun 2018 01:45:08 +0200
changeset 8 5459fff1356b
parent 7 a40fd3990850
child 9 d15e18c2dab2
make sure the folder does not already exists
data/script/scrapeso.py
--- a/data/script/scrapeso.py	Thu Jun 28 18:50:20 2018 +0200
+++ b/data/script/scrapeso.py	Fri Jun 29 01:45:08 2018 +0200
@@ -129,7 +129,9 @@
 
             infosdict['image']['imgurl'] = imgurl
             imgdirectory = directory + imgid
-        #if not os.path.exists(imgdirectory):
+            if os.path.exists(imgdirectory):
+                print("Problem processing %s, folder already exists with id %s " % (realurl, imgid))
+                continue
             os.mkdir(imgdirectory)
             imgdirection = imgdirectory + "/" + img
             urllib.request.urlretrieve(imgurl, imgdirection)