RhetTbull / PhotoScript

Automate Apple / MacOS Photos app with python. Wraps applescript calls in python to allow automation of Photos from python code.
MIT License
49 stars 5 forks source link

selection fails if user selects a "shared with you" image in the Library on Ventura #45

Open RhetTbull opened 1 year ago

RhetTbull commented 1 year ago
>>> photoscript.PhotosLibrary().selection
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rhet/.pyenv/versions/osxphotos/lib/python3.11/site-packages/photoscript/__init__.py", line 132, in selection
    uuids = run_script("photosLibraryGetSelection")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rhet/.pyenv/versions/osxphotos/lib/python3.11/site-packages/photoscript/script_loader.py", line 18, in run_script
    return SCRIPT_OBJ.call(name, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rhet/.pyenv/versions/osxphotos/lib/python3.11/site-packages/applescript/__init__.py", line 110, in call
    return self._unpackresult(*self._script.executeAppleEvent_error_(evt, None))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rhet/.pyenv/versions/osxphotos/lib/python3.11/site-packages/applescript/__init__.py", line 65, in _unpackresult
    raise ScriptError(errorinfo)
applescript.ScriptError: Photos got an error: Can’t get media item id "0034BCF0-4D72-451B-9F95-4D0522F05843/L0/001". (-1728) app='Photos' range=16820-16873
RhetTbull commented 1 year ago

I may not be able to fix this as it's an AppleScript interface limitation

RhetTbull commented 1 year ago

May be able to handle inside the AppleScript?