PIL fails when trying to parse a streaming png file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-imaging (Ubuntu) |
Expired
|
Medium
|
Unassigned |
Bug Description
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/
self.load()
File "/usr/lib/
s = read(self.
File "/usr/lib/
return self.fp.read(bytes)
File "/usr/lib/
data = self.data[
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.
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
Changed in python-imaging (Ubuntu): | |
importance: | Undecided → Medium |
status: | Confirmed → Triaged |
Tested on my upto date Jaunty box, and confirmed.