From 123ebb2cb752bb94291ac2b77e4a327cee996df1 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Fri, 8 Jan 2021 06:23:17 -0800 Subject: [PATCH] Ensure merge_exif_keywords are str not int --- osxphotos/photoinfo/_photoinfo_export.py | 31 +++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/osxphotos/photoinfo/_photoinfo_export.py b/osxphotos/photoinfo/_photoinfo_export.py index 3445c916..366c8b8d 100644 --- a/osxphotos/photoinfo/_photoinfo_export.py +++ b/osxphotos/photoinfo/_photoinfo_export.py @@ -776,7 +776,12 @@ def export2( photo = [p for p in bursts if p.uuid.startswith(self.uuid)] photo = photo[0] if photo else None if not photo: - all_results.error.append((str(dest), f"PhotoKitFetchFailed exception exporting photo {self.uuid}: {e}")) + all_results.error.append( + ( + str(dest), + f"PhotoKitFetchFailed exception exporting photo {self.uuid}: {e}", + ) + ) if photo: try: exported = photo.export( @@ -821,7 +826,7 @@ def export2( if photo: try: exported = photo.export( - dest.parent, dest.name, version=PHOTOS_VERSION_ORIGINAL + dest.parent, dest.name, version=PHOTOS_VERSION_ORIGINAL ) all_results.exported.extend(exported) except Exception as e: @@ -829,15 +834,15 @@ def export2( else: try: exported = _export_photo_uuid_applescript( - self.uuid, - dest.parent, - filestem=filestem, - original=True, - edited=False, - live_photo=live_photo, - timeout=timeout, - burst=self.burst, - dry_run=dry_run, + self.uuid, + dest.parent, + filestem=filestem, + original=True, + edited=False, + live_photo=live_photo, + timeout=timeout, + burst=self.burst, + dry_run=dry_run, ) all_results.exported.extend(exported) except ExportError as e: @@ -852,7 +857,7 @@ def export2( all_results.new.extend(all_results.exported) # else: - # all_results.error.append((str(dest), f"Error exporting photo {self.uuid} to {dest} with use_photos_export")) + # all_results.error.append((str(dest), f"Error exporting photo {self.uuid} to {dest} with use_photos_export")) # export metadata sidecars = [] @@ -1539,6 +1544,7 @@ def _get_exif_keywords(self): kw = exifdict[field] if kw and type(kw) != list: kw = [kw] + kw = [str(k) for k in kw] keywords.extend(kw) except KeyError: pass @@ -1555,6 +1561,7 @@ def _get_exif_persons(self): p = exifdict["XMP:PersonInImage"] if p and type(p) != list: p = [p] + p = [str(p_) for p_ in p] persons.extend(p) except KeyError: pass