From 5d4d7d7db7ca1109b6230803fe777d7a30882efe Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Thu, 12 Nov 2020 06:18:28 -0800 Subject: [PATCH] Fixed path for photos actually missing off disk --- osxphotos/__main__.py | 6 +++--- osxphotos/photoinfo/photoinfo.py | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osxphotos/__main__.py b/osxphotos/__main__.py index 6f827bfc..30bf30ba 100644 --- a/osxphotos/__main__.py +++ b/osxphotos/__main__.py @@ -2341,10 +2341,10 @@ def export_photo( space = " " if not verbose_ else "" verbose(f"{space}Skipping missing photo {photo.original_filename}") return ExportResults([], [], [], [], [], []) - elif not os.path.exists(photo.path): + elif photo.path is None: space = " " if not verbose_ else "" verbose( - f"{space}WARNING: file {photo.path} is missing but ismissing=False, " + f"{space}WARNING: photo {photo.original_filename} ({photo.uuid}) is missing but ismissing=False, " f"skipping {photo.original_filename}" ) return ExportResults([], [], [], [], [], []) @@ -2396,7 +2396,7 @@ def export_photo( download_missing and ( photo.ismissing - or not os.path.exists(photo.path) + or photo.path is None or (export_edited and photo.path_edited is None) ) ) diff --git a/osxphotos/photoinfo/photoinfo.py b/osxphotos/photoinfo/photoinfo.py index 3eacc4de..c7b34d6c 100644 --- a/osxphotos/photoinfo/photoinfo.py +++ b/osxphotos/photoinfo/photoinfo.py @@ -164,6 +164,8 @@ class PhotoInfo: photopath = os.path.join( self._db._masters_path, self._info["imagePath"] ) + if not os.path.isfile(photopath): + photopath = None self._path = photopath return photopath @@ -175,6 +177,8 @@ class PhotoInfo: self._info["directory"], self._info["filename"], ) + if not os.path.isfile(photopath): + photopath = None self._path = photopath return photopath @@ -188,6 +192,8 @@ class PhotoInfo: self._info["directory"], self._info["filename"], ) + if not os.path.isfile(photopath): + photopath = None self._path = photopath return photopath