From c4824b0f16cd5c4c1b8232a3ffbfecb3b2d4bd76 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 20 Jan 2012 11:34:46 -0500 Subject: [PATCH] [#185 state:fixed] Made an iPhoto-appscript error a bit friendlier. --- cocoa/inter/app_pe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cocoa/inter/app_pe.py b/cocoa/inter/app_pe.py index fff54332..b418b6ae 100644 --- a/cocoa/inter/app_pe.py +++ b/cocoa/inter/app_pe.py @@ -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))