[Image-SIG] PNG Support with Parsed images.

Stephane JAIS jais at exalead.com
Wed Apr 30 16:26:56 CEST 2008


Hello,

I'm trying to use ImageFile.Parser() to parse a PNG file like this:
 >>> import ImageFile
 >>> f = open('pic.png')
 >>> p=ImageFile.Parser()
 >>> p.feed(f.read())
 >>> i=p.close()
 >>> i.show()

And I'm getting:
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ 
Image.py", line 1449, in show
     _showxv(self, title, command)
   File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ 
Image.py", line 2082, in _showxv
     file = image._dump(format=format)
   File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ 
Image.py", line 476, in _dump
     self.load()
   File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ 
ImageFile.py", line 189, in load
     s = read(self.decodermaxblock)
   File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ 
PngImagePlugin.py", line 365, in load_read
     return self.fp.read(bytes)
   File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ 
ImageFile.py", line 300, in read
     data = self.data[pos:pos+bytes]
TypeError: unsubscriptable object


The problem has been noted on that very list before:
http://www.mailinglistarchive.com/image-sig@python.org/msg00513.html

I am wandering if a bug report has been opened, and if any workaround  
exists.
Thanks,

    Stephane



More information about the Image-SIG mailing list