question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Icon Image ValueError difficult to interpret

See original GitHub issue

Pillow is raising a ValueError and Newspaper is printing it. It should instead be raised for the exception handler on images:153 so the user knows what’s happening (i.e. what url failed, etc…).

Traceback (most recent call last):
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/newspaper/images.py", line 121, in fetch_url
   p.feed(new_data)
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/ImageFile.py", line 377, in feed
   im = Image.open(fp)
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/Image.py", line 2299, in open
   im = _open_core(fp, filename, prefix)
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/Image.py", line 2289, in _open_core
   im = factory(fp, filename)
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/ImageFile.py", line 97, in __init__
   self._open()
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/IcoImagePlugin.py", line 264, in _open
   self.load()
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/IcoImagePlugin.py", line 267, in load
   im = self.ico.getimage(self.size)
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/IcoImagePlugin.py", line 150, in getimage
   return self.frame(i)
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/IcoImagePlugin.py", line 201, in frame
   ('L', 0, -1)    # 8bpp inverted, unpadded, reversed
 File "/var/virtualenvs/centr/lib/python3.5/site-packages/PIL/Image.py", line 2131, in frombuffer
   core.map_buffer(data, size, decoder_name, None, 0, args)
ValueError: buffer is not large enough

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Wyosotiscommented, Dec 3, 2016

Hello! I have another example URL where it still happens https://yandex.st/lego/_/Gkmfl8ZxooHEnbHJEo5KoZ0AVP0.ico

Traceback (most recent call last):
  File "D:\Project\Part 2\ex.py", line 58, in get_image_size
    p.feed(data)
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFile.py", line 383, in feed
    im = Image.open(fp)
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\Image.py", line 2309, in open
    im = _open_core(fp, filename, prefix)
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\Image.py", line 2299, in _open_core
    im = factory(fp, filename)
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFile.py", line 97, in __init__
    self._open()
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\IcoImagePlugin.py", line 264, in _open
    self.load()
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\IcoImagePlugin.py", line 267, in load
    im = self.ico.getimage(self.size)
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\IcoImagePlugin.py", line 150, in getimage
    return self.frame(i)
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\IcoImagePlugin.py", line 201, in frame
    ('L', 0, -1)    # 8bpp inverted, unpadded, reversed
  File "C:\Users\Myosotis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\Image.py", line 2132, in frombuffer
    core.map_buffer(data, size, decoder_name, None, 0, args)
ValueError: buffer is not large enough
1reaction
adamncommented, Jun 9, 2016

This is broken in 0.1.7 but is now fixed 😃

So, no worries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I open images in a Google Colaboratory notebook ...
In Google Colab, open the file browser icon (left nav bar) and navigate to ... 'image/gif' else: raise ValueError('Unknown extension: %s' ...
Read more >
3 Ways to Add Images to Your Jupyter Notebook - Essi Alizadeh
Approach 1: Add an image from a local file. We can add images from your local drive by providing the path to the...
Read more >
How to correct a #VALUE! error - Microsoft Support
In this case, try using a function instead. Functions will often ignore text values and calculate everything as numbers, eliminating the #VALUE! error....
Read more >
Handling Missing Data in Pandas: NaN Values Explained
Handling Missing Data in Pandas: NaN Values Explained. December 23, 2020. 3 minute read. Walker Rowe. In applied data science, you will usually...
Read more >
ValueError - Laur's blog - Laur IVAN
More: -ajax 12.1 2 2.1.7 2016 3 3d 400 404 418 530 56 7 8 aapt access accessort account actionbar activity ad7 adb...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found