From 19a8c2b99732538d005410d3619e3bf9a67a3a82 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Mon, 1 Apr 2019 20:58:45 +0900 Subject: [PATCH] Fix for [Bug with exempi 2.5.0 #1] With exempi 2.5.0 when the get_property was called on an unset one, it crashed with "unkown error". Fix with checking if property exists before actually getting the property --- bin/reverse_geolocate.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/reverse_geolocate.py b/bin/reverse_geolocate.py index d95ea10..2d43621 100755 --- a/bin/reverse_geolocate.py +++ b/bin/reverse_geolocate.py @@ -1102,7 +1102,11 @@ for xmp_file in work_files: # read fields from the XMP file and store in hash xmp.parse_from_str(strbuffer) for xmp_field in xmp_fields: - data_set[xmp_field] = xmp.get_property(xmp_fields[xmp_field], xmp_field) + # need to check if propert exist or it will the exempi routine will fail + if xmp.does_property_exist(xmp_fields[xmp_field], xmp_field): + data_set[xmp_field] = xmp.get_property(xmp_fields[xmp_field], xmp_field) + else: + data_set[xmp_field] = '' if args.debug: print("### => XMP: {}:{} => {}".format(xmp_fields[xmp_field], xmp_field, data_set[xmp_field])) if args.read_only: