Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Sorry, image link is broken" on all images attempted #41

Closed
ftw37 opened this issue Aug 20, 2014 · 19 comments
Closed

"Sorry, image link is broken" on all images attempted #41

ftw37 opened this issue Aug 20, 2014 · 19 comments
Labels

Comments

@ftw37
Copy link

ftw37 commented Aug 20, 2014

Every time an image is in a tweet, I get a "Sorry, image link is broken" instead of the inline image.

config
HEARTBEAT_TIMEOUT: 120
IMAGE_ON_TERM: True
THEME: monokai
ASCII_ART: True
HIDE_PROMPT: True
PREFIX: @ftw
SEARCH_MAX_RECORD: 5
HOME_TWEET_NUM: 5
RETWEETS_SHOW_NUM: 5
QUOTE_FORMAT: #comment RT #owner: #tweet
MESSAGES_DISPLAY: 5
TREND_MAX: 10
LIST_MAX: 5
HISTORY_FILENAME: completer.hist
IMAGE_SHIFT: 2
IMAGE_MAX_HEIGHT: 90
USER_DOMAIN: userstream.twitter.com
PUBLIC_DOMAIN: stream.twitter.com
SITE_DOMAIN: sitestream.twitter.com

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

Hello @ftw37 , can you specify your Python version ?

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

ftw@ftw-701SD:~$ python -V
Python 2.7.3

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

@ftw37: thanks for report, I am using Python 2.7 on Mac and Linux and don't experienced same problem. Can you try the following line in a Python interpreter and let me know if there is an exception ?

>>> import requests
>>> from PIL import Image
>>> from io import BytesIO
>>> res = requests.get('https://avatars3.githubusercontent.com/u/479796?v=2&s=460')
>>> Image.open(BytesIO(res.content))

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

ftw@ftw-701SD:~$ python
Python 2.7.3 (default, Feb 27 2014, 20:00:17) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from PIL import Image
>>> from io import BytesIO
>>> res = requests.get('https://avatars3.githubusercontent.com/u/479796?v=2&s=460')
>>> Image.open(BytesIO(res.content))
<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=460x460 at 0x87BF84C>
>>> 

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

So there is no exception ? It's really strange. May I see the output of which rainbowstream ?

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

ftw@ftw-701SD:~$ which rainbowstream
/usr/local/bin/rainbowstream

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

I guess that you installed by sudo pip install rainbowstream. Could you try again with the virtualenv way (should be done after sudo pip uninstall rainbowstream)and see if the error still exists ?.

In that case, please provide the output of

  • which rainbowstream
  • which cc
  • which gcc

and I will try to continue to debug. By the way, what OS are you using ?

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

Ubuntu 14.04.5

After installing using virtualenv method (and uninstalling prev version):

ftw@ftw-701SD:~$ which rainbowstream
ftw@ftw-701SD:~$ which gcc
/usr/bin/gcc
ftw@ftw-701SD:~$ which cc
/usr/bin/cc

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

BTW, the image in this recent tweet did show up:

Why did the ducks cross the road? http://t.co/RNNbrCp6Od #YouCanBreatheNow pic.twitter.com/BPCKx9yq2M

— George Takei (@GeorgeTakei) August 20, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

Does which rainbowstream not output anything ? I expect smt like ..../venv/bin/rainbowstream

Anw, please stay for a while to see the "Sorry, image link is broken" error appears or not .

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

(venv)ftw@ftw-701SD:~$ which rainbowstream
/home/ftw/venv/bin/rainbowstream
(venv)ftw@ftw-701SD:~$ which gcc
/usr/bin/gcc
(venv)ftw@ftw-701SD:~$ which cc
/usr/bin/cc

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

Does the "Sorry, image link is broken" error still exists ?

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

Yes, unfortunately

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

Okay, let's go fix it up.
Navigate to your /home/ftw/venv/lib/python2.7/site-packages/rainbowstream/draw.py , line 318 ~ 319 and modify it like this

except Exception as e:
    print(e)
    import traceback
    print(traceback.format_exc())
    printNicely(red('Sorry, image link is broken'))

Then start the app, wait for an error and paste back here what is printed out :)

@ftw37
Copy link
Author

ftw37 commented Aug 20, 2014

http://t.co/7FsmMrwsct
decoder jpeg not available
Traceback (most recent call last):
  File "/home/ftw/venv/local/lib/python2.7/site-packages/rainbowstream/draw.py", line 317, in draw
    image_to_display(BytesIO(response.content))
  File "/home/ftw/venv/local/lib/python2.7/site-packages/rainbowstream/c_image.py", line 44, in image_to_display
    i = i.convert('RGBA')
  File "/home/ftw/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 822, in convert
    self.load()
  File "/home/ftw/venv/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 191, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/home/ftw/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 413, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

@orakaro
Copy link
Owner

orakaro commented Aug 20, 2014

After googling a bit, I think the solution will be

sudo apt-get install libjpeg-dev
pip install -I PIL  # inside virtualenv
rainbowstream -iot # this time should be fine

@ftw37
Copy link
Author

ftw37 commented Aug 21, 2014

Fixed. Thanks so much for your help!

Had to follow similar instructions as above. Found here:
http://askubuntu.com/questions/156484/how-do-i-install-python-imaging-library-pil

@orakaro
Copy link
Owner

orakaro commented Aug 21, 2014

👍

@orakaro orakaro closed this as completed Aug 21, 2014
@psivesely
Copy link

I'm having the same issue w/ Ubuntu 14.04 and Python 3.4.0. I your fix from Aug. 20th, however, it seems that PIL is no longer an available Python package: "Could not find any downloads that satisfy the requirement PIL."

Traceback is pretty much the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants