Accessing the Photos Library from an AppleScript

Dear all,

I am battling with an issue on one of my Macs where the process “com.apple.photomodel” is using up all the CPU capacity. (Issue been known for a long time, but Apple has done nothing about it … See: https://discussions.apple.com/thread/7321574?start=15&tstart=0 )

One of the reasons suggest is that there is a file somewhere in the library that can not be processed. So fr so good. BUT how do I find the perpetrator?

I was hoping I could write an AppleScript to traverse the library and check for files that are NOT image files just to t least eliminate those.

But I got stuck at the very beginning … I get an error message “no such object” -1728.

I am using a Germany Localized System, where the Finder displays the name of the Pictures Folder as “Bilder”, but the POSIX name is still “Pictures”

Here’S my silly little script (stripped down to the bare minimum)


use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set PhotoLibMaster to POSIX path of ("/Users/<<UserName>>/Pictures/Fotos-Mediathek.photoslibrary/Masters/")

log PhotoLibMaster

tell application "Finder"
	set filenames to every file of entire contents of folder PhotoLibMaster whose name extension is "JPG"
end tell
log (count of filenames)

Any Idea whay this is not working?

BR
Yonz

Hi all,

it turns out that this is almost impossible (i.e. to access the PHOTOS Library thru the backdoor)

To solve my problem with the “com.apple.photomodel” process, I ended up doing a brute force reset
by creating a new empty Photos Library and re-syncing all images (in my case 26000). This whole process, incl. downloading the originals, took ca 72 hours. But afterwards I’ve hat no problems with that rogue process