Skip to content Skip to sidebar Skip to footer

Python3 Exif Orientation KeyError: '274'

I'm trying to pull the Exif orientation from an image, but for some reason I keep getting KeyError: '274', even though it seems to be in the dictionary with a value of '8'. Snippet

Solution 1:

The keys are integers, '274' is a string. Try image_exif[274]. This, however, will lead to another error since strings and integers can't be concatenated.

Use .format:

print('orientation2: {}'.format(image_exif[274]))

Post a Comment for "Python3 Exif Orientation KeyError: '274'"