fix image IOError
authorvunhat_minh <vunhat_minh@dwango.co.jp>
Thu, 10 Jul 2014 11:03:18 +0000 (20:03 +0900)
committervunhat_minh <vunhat_minh@dwango.co.jp>
Thu, 10 Jul 2014 11:03:18 +0000 (20:03 +0900)
rainbowstream/draw.py
setup.py

index faf57f93a5ed97d47e8c05f4194c3fe912bc5345..57e7867497265c4aea9d7ffea54c3ffbac7e045f 100644 (file)
@@ -256,8 +256,11 @@ def draw(t, iot=False, keyword=None, fil=[], ig=[]):
     # Display Image
     if iot and media_url:
         for mu in media_url:
-            response = requests.get(mu)
-            image_to_display(StringIO(response.content))
+            try:
+                response = requests.get(mu)
+                image_to_display(StringIO(response.content))
+            except:
+                printNicely(red('Sorry, image link is broken'))
 
 
 def print_message(m):
@@ -386,8 +389,11 @@ def show_profile(u, iot=False):
     printNicely('')
     printNicely(line1)
     if iot:
-        response = requests.get(profile_image_url)
-        image_to_display(StringIO(response.content), 2, 20)
+        try:
+            response = requests.get(profile_image_url)
+            image_to_display(StringIO(response.content), 2, 20)
+        except:
+            pass
     else:
         printNicely(line2)
     for line in [line3, line4, line5, line6]:
index d55414a00e60521f03d0c41d8ac0541f0015037d..af31317ca3735016e4ff4fe94ddaafaba3d67ee4 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = '0.2.6'
+version = '0.2.7'
 
 install_requires = [
     "python-dateutil",