pexif icon indicating copy to clipboard operation
pexif copied to clipboard

`ifd_maker_note` may raise error if exif_file.make is not set yet

Open acenqiu opened this issue 9 years ago • 5 comments

There is a possibility that MakerNote section is in front of Make section, which will raise an exception as follows:

AttributeError: ExifSegment instance has no attribute 'make'

Example photo links:

http://d3drsuq3xbnvq3.cloudfront.net/jp/pictures/201501/536906316/61e48289a1854983abba557ec1c6724c.jpeg

http://d3drsuq3xbnvq3.cloudfront.net/jp/pictures/201507/536906316/212a0c03410f5ed53c0ff8150216b10a.jpeg

acenqiu avatar Aug 19 '15 08:08 acenqiu

A possible workaround is just skip this section.

def ifd_maker_note(e, offset, exif_file, mode, data):
    try:
        exif_file.make
    except AttributeError:
        msg = "Haven't got make yet. Skipping."
        raise JpegFile.SkipTag(msg)

    # ...
end

acenqiu avatar Aug 19 '15 08:08 acenqiu

I confirm the above fix works

mcrichards avatar Oct 25 '16 01:10 mcrichards

It would be cool if this could be put on pypi.

But it is cool anyway that the fix is here to apply manually :)

gabn88 avatar Jan 16 '17 20:01 gabn88

Is anyone addressing this? I can confirm that christophlingg's code in commit https://github.com/komoot/pexif/commit/b6f42517c82a2c1c47c691e429129e722029ca7b works

abaldwin1 avatar Oct 02 '17 22:10 abaldwin1

Thanks for the fix, would be great to have this fix released. Meanwhile we have to :monkey: patch

witekdev avatar Jun 15 '18 19:06 witekdev