Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osxphotos repl doesn't work when connected via ssh due to AppleScript #1332

Closed
RhetTbull opened this issue Dec 15, 2023 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@RhetTbull
Copy link
Owner

AppleScript cannot get selected photos when connected via ssh:

                                                                                                 │
│   69 │                                                                                           │
│   70 │   def __len__(self) -> int:                                                               │
│   71 │   │   """Return number of selected photos"""                                              │
│ ❱ 72 │   │   return len(self._get_selection())                                                   │
│   73                                                                                             │
│   74                                                                                             │
│   75 def get_selected(photosdb: PhotosDB):                                                       │
│                                                                                                  │
│ /Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/photos_selection. │
│ py:48 in _get_selection                                                                          │
│                                                                                                  │
│   45 │                                                                                           │
│   46 │   def _get_selection(self) -> list[PhotoInfo]:                                            │
│   47 │   │   """Return list of selected photos"""                                                │
│ ❱ 48 │   │   return get_selected(self._photosdb)                                                 │
│   49 │                                                                                           │
│   50 │   def __getitem__(self, index) -> PhotoInfo:                                              │
│   51 │   │   """Return PhotoInfo object for selected photo at index"""                           │
│                                                                                                  │
│ /Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/photos_selection. │
│ py:86 in get_selected                                                                            │
│                                                                                                  │
│   83 │   │   if match := re.match(r".*Can’t get media item id \"(.*)\".*", str(e)):              │
│   84 │   │   │   uuid = match[1].split("/")[0]                                                   │
│   85 │   │   │   return photosdb.photos(uuid=[uuid])                                             │
│ ❱ 86 │   return photosdb.photos(uuid=[p.uuid for p in selected]) if selected else []             │
│   87                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnboundLocalError: cannot access local variable 'selected' where it is not associated with a value
@RhetTbull RhetTbull added the bug Something isn't working label Feb 24, 2024
RhetTbull added a commit that referenced this issue Feb 25, 2024
RhetTbull added a commit that referenced this issue Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant