Public bug reported:

Binary package hint: python-imaging

PIL 1.1.6-3ubuntu1 fails when operating on an png file from its parser() method 
with
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 961, in histogram
    self.load()
  File "/usr/lib/python2.6/dist-packages/PIL/ImageFile.py", line 189, in load
    s = read(self.decodermaxblock)
  File "/usr/lib/python2.6/dist-packages/PIL/PngImagePlugin.py", line 365, in 
load_read
    return self.fp.read(bytes)
  File "/usr/lib/python2.6/dist-packages/PIL/ImageFile.py", line 300, in read
    data = self.data[pos:pos+bytes]
TypeError: 'NoneType' object is unsubscriptable

this python script will expose the bug:
#!/usr/bin/env python
import PIL.ImageFile
imgfile = open('foo.png')
p = PIL.ImageFile.Parser()

while 1:
    data = imgfile.read(1024)
    if not data:
        break
    p.feed(data)

img = p.close()
img.histogram() # simple operation on PIL.Image object, should work but fails 
on png files

Attached is a patch that fixes this, a lack of any bug
tracker/development contact for python-imaging upstream necessitates it
being here. Bug exists on 9.04 definatly

** Affects: python-imaging (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: pil python-imaging

-- 
PIL fails when trying to parse a streaming png file
https://bugs.launchpad.net/bugs/383228
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to