diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2008-01-20 17:17:54 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2008-01-20 17:17:54 +0100 |
commit | 69cd8141ab474771069175eff168b117d49cfa18 (patch) | |
tree | 6edfd4911634a810481bd2241d184564b91fec13 /src | |
parent | b6b0a404a44acc5227ed10104d2d028843026d6b (diff) | |
download | pyexiv2-69cd8141ab474771069175eff168b117d49cfa18.tar.gz |
Fixed bug #173387 (Error reading Exif.Photo.UserComment): the value of tag "Exif.Photo.UserComment" (and other malformed tags of type Undefined) is now returned directly as a human-readable string.
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): """ |