[#185 state:fixed] Made an iPhoto-appscript error a bit friendlier.

This commit is contained in:
Virgil Dupras 2012-01-20 11:34:46 -05:00
parent ea32af04fb
commit c4824b0f16
1 changed files with 5 additions and 1 deletions

View File

@ -154,7 +154,11 @@ class DupeGuruPE(DupeGuruBase):
if isinstance(dupe, IPhoto):
try:
a = app('iPhoto')
[photo] = a.photo_library_album().photos[its.image_path == str(dupe.path)]()
album = a.photo_library_album()
if album is None:
msg = "There are communication problems with iPhoto. Try opening iPhoto first, it might solve it."
raise EnvironmentError(msg)
[photo] = album.photos[its.image_path == str(dupe.path)]()
a.remove(photo, timeout=0)
except ValueError:
msg = "Could not find photo '{}' in iPhoto Library".format(str(dupe.path))