commit 2fd6ec3051712a74889473a262f01f2ba3ee7633
parent 1dad191ff8d25caa087a43b9a6880593d91ea2e2
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Thu, 13 Oct 2016 17:45:34 +0200
Update download-image-by-link.py
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/scripts/download-image-by-link.py b/scripts/download-image-by-link.py
@@ -22,7 +22,10 @@ def store_raw_images():
try:
i
try:
- urllib2.urlretrieve(i, "neg/"+str(pic_num)+".jpg")
+ f = urllib2.urlopen(i)
+ data = f.read()
+ with open("neg/"+str(pic_num)+".jpg", "wb") as code:
+ code.write(data)
except (HTTPError, URLError) as error:
fail_url = 0
except timeout:
@@ -55,7 +58,10 @@ def store_raw_images2():
try:
i
try:
- urllib2.urlretrieve(i, "neg/"+str(pic_num)+".jpg")
+ f = urllib2.urlopen(i)
+ data = f.read()
+ with open("neg/"+str(pic_num)+".jpg", "wb") as code:
+ code.write(data)
except (HTTPError, URLError) as error:
fail_url = 0
except timeout:
@@ -88,7 +94,10 @@ def store_raw_pos_images():
try:
i
try:
- urllib2.urlretrieve(i, "pos/"+str(pic_num)+".jpg")
+ f = urllib2.urlopen(i)
+ data = f.read()
+ with open("pos/"+str(pic_num)+".jpg", "wb") as code:
+ code.write(data)
except (HTTPError, URLError) as error:
fail_url = 0
except timeout: