diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pyexiv2.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 5a03213..139d157 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -334,10 +334,14 @@ class Image(libpyexiv2.Image): # tagValue is a sequence of bytes whose codes are written as a # string, each code being followed by a blank space (e.g. # "48 50 50 49 " for "0221"). - # Note: in the case of tag "Exif.Photo.UserComment", it is better to - # call method __getExifTagToString() to obtain directly the value as - # a human-readable string. - return UndefinedToString(tagValue) + try: + return UndefinedToString(tagValue) + except ValueError: + # Some tags such as "Exif.Photo.UserComment" are marked as + # Undefined but do not store their value as expected. + # This should fix bug #173387. The value will be returned + # directly as a human-readable string. + return self.__getExifTagToString(key) def __setExifTagValue(self, key, value): """ |