[New-bugs-announce] [issue18791] PIL freeze reading Jpeg file

lolo27 report at bugs.python.org
Tue Aug 20 22:33:44 CEST 2013

New submission from lolo27:

With this Python program and 20070517-152405_lovers_4 (copie).jpg  (this file is ok whith Gimp and others programs).

Program "freeze" ( line print "Done" is not processing).

from PIL import Image
from PIL.ExifTags import TAGS
def get_exif(fn):
    ret = {}
    i = Image.open(fn)
    info = i._getexif()
    for tag, value in info.items():
        decoded = TAGS.get(tag, tag)
        ret[decoded] = value
    return ret
get_exif("./20070517-152405_lovers_4 (copie).jpg")
print "Done"

Console output  :

Traceback (most recent call last):
  File "pil_exif.py", line 14, in <module>
    get_exif("./20070517-152405_lovers_4 (copie).jpg")
  File "pil_exif.py", line 7, in get_exif
    info = i._getexif()
  File "/usr/lib/python2.7/dist-packages/PIL/JpegImagePlugin.py", line 381, in _getexif
  File "/usr/lib/python2.7/dist-packages/PIL/TiffImagePlugin.py", line 348, in load
    for i in range(i16(fp.read(2))):
  File "/usr/lib/python2.7/dist-packages/PIL/TiffImagePlugin.py", line 68, in il16
    return ord(c[o]) + (ord(c[o+1])<<8)
IndexError: string index out of range


Linux Mint : Linux mystation 3.2.0-4-amd64 #1 SMP Debian 3.2.32-1 x86_64 GNU/Linux
Python :  2.7.3rc2 (no additional lib installed)
TiffImagePlugin.py : __version__ = "1.3.5"

files: 20070517-152405_lovers_4 (copie).jpg
messages: 195715
nosy: lolo27
priority: normal
severity: normal
status: open
title: PIL freeze reading Jpeg file
type: crash
Added file: http://bugs.python.org/file31387/20070517-152405_lovers_4 (copie).jpg

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list