with open("images/samples/img12.jpg", "rb") as file:
img = Image(file)
print(img.user_comment)
Gives a nasty error:
Traceback (most recent call last):
File "/Users/ahmet_celtik/Google Drive/DIT/DT211C-4/Final Year Project/Python/exifSorting.py", line 222, in <module>
read()
File "/Users/ahmet_celtik/Google Drive/DIT/DT211C-4/Final Year Project/Python/exifSorting.py", line 213, in read
print(img.get("user_comment"))
File "/Users/ahmet_celtik/cv-py3/lib/python3.7/site-packages/exif/_image.py", line 88, in get
retval = self.__getattr__(attribute)
File "/Users/ahmet_celtik/cv-py3/lib/python3.7/site-packages/exif/_image.py", line 57, in __getattr__
return getattr(self._segments['APP1'], item)
File "/Users/ahmet_celtik/cv-py3/lib/python3.7/site-packages/exif/_app1_metadata.py", line 205, in __getattr__
return ifd_tag.read()
File "/Users/ahmet_celtik/cv-py3/lib/python3.7/site-packages/exif/_ifd_tag.py", line 145, in read
retval = self._read_as_numeric()
File "/Users/ahmet_celtik/cv-py3/lib/python3.7/site-packages/exif/_ifd_tag.py", line 211, in _read_as_numeric
raise RuntimeError("unknown datatype value {0}".format(self.dtype))
RuntimeError: unknown datatype value 7
I just released version 0.5.1 of the package (see #17) which adds support for parsing the user comment data structure. Don't hesitate to follow-up with an additional issue if necessary.
Gives a nasty error: