Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process_file() crashes on (some?) HEIF files #197

Open
patrick-brian-mooney opened this issue Apr 11, 2024 · 0 comments
Open

process_file() crashes on (some?) HEIF files #197

patrick-brian-mooney opened this issue Apr 11, 2024 · 0 comments

Comments

@patrick-brian-mooney
Copy link

patrick-brian-mooney commented Apr 11, 2024

I have some files with .jpg extensions that are actually HEIF files. (I suspect it's the Android app for Instagram generating them on my phone, but haven't followed up.) Trying to process them with my normal processing script causes exiftool.process_file() to crash.

Here's a simplified version of the code causing the crash:

import exifread
with open("""IMG_20240322_014811_458.jpg""", 'rb') as f:
    tags = exifread.process_file(f, details=False)

Here's a stack trace showing what's happening:

Traceback (most recent call last):
  File "/usr/lib/python3.8/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 2, in <module>
  File "/home/patrick/Documents/programming/python_projects/photo-processing/lib/python3.8/site-packages/exifread/__init__.py", line 242, in process_file
    offset, endian = heic.find_exif()
  File "/home/patrick/Documents/programming/python_projects/photo-processing/lib/python3.8/site-packages/exifread/heic.py", line 240, in find_exif
    item_id = meta.subs['iinf'].exif_infe.item_id
AttributeError: 'NoneType' object has no attribute 'item_id'

It looks like heic.find_exif() is returning None, but later code isn't checking for that possibility.

And I'm attaching a copy of a file that causes the crash:

IMG_20240322_014811_458.jpg.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant