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

KeyError: hdlr #160

Closed
JonathanRoth13 opened this issue Jan 18, 2022 · 6 comments
Closed

KeyError: hdlr #160

JonathanRoth13 opened this issue Jan 18, 2022 · 6 comments

Comments

@JonathanRoth13
Copy link

i encountered this error using python 3.9.2 and while trying to extract exif data from a HEIC file.
2022-01-18_screenshot_bumbling : bash

exifread

@aapris
Copy link

aapris commented Jun 2, 2022

pip install "exifread<3" solved this for me.

I'm on macOS (Apple silicon).

@helgeerbe
Copy link

Works fine on macos, but fails on raspberrypi

@samrushing
Copy link
Contributor

I just came across the same issue. No idea what 'hdlr' contains. In the exiv2 source it parses it with a function called parseHandler (in quicktimevideo.cpp). Just skipping it seems to work, though:

diff --git a/exifread/heic.py b/exifread/heic.py
index 1109d15..e61f833 100644
--- a/exifread/heic.py
+++ b/exifread/heic.py
@@ -158,6 +158,11 @@ def parse_meta (self, meta):
             # skip any unparsed data
             self.skip (box)

+    def parse_hdlr (self, box):
+        self.get_full (box)
+        # can I just ignore it?
+        self.skip (box)
+
     def parse_infe (self, box):
         self.get_full (box)
         if box.version >= 2:

hpoul added a commit to hpoul/exif-py that referenced this issue Feb 27, 2023
@hpoul
Copy link
Contributor

hpoul commented Feb 27, 2023

imho just ignoring it would be the right thing to do, i've created a PR #175

fwiw, the following monkey patch also seems to work for me..

def _monkey_patch_exifread():
    from exifread import HEICExifFinder
    from exifread.heic import NoParser

    _old_get_parser = HEICExifFinder.get_parser

    def _get_parser(self, box):
        try:
            return _old_get_parser(self, box)
        except NoParser:
            logger.warning("ignoring parser %s", box.name)
            return None

    HEICExifFinder.get_parser = _get_parser


_monkey_patch_exifread()

ianare pushed a commit to hpoul/exif-py that referenced this issue May 2, 2023
@ianare ianare closed this as completed in a5a442a May 2, 2023
@honzajavorek
Copy link

Seems like this is not yet fully fixed? #184

@OPunWide
Copy link

This is still an issue.
I'm trying to parse an image that was made on an iPhone, but the Python code and the image are on Win11 WSL.

It's the error during the process_file call:

  File ".../lib/python3.8/site-packages/exifread/heic.py", line 173, in get_parser
      raise NoParser(box.name) from err
  exifread.heic.NoParser: hdlr

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

7 participants