Open torarnv opened 1 month ago
Error:
Traceback (most recent call last):
File "/Users/torarne/dev/osxphotos/osxphotos/fileutil.py", line 308, in copy
shutil.copy(str(src), str(dest))
File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 419, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 256, in copyfile
with open(src, 'rb') as fsrc:
^^^^^^^^^^^^^^^
PermissionError: [Errno 1] Operation not permitted: '/Users/torarne/Pictures/Photos Library.photoslibrary/database/photos.db'
Worked after giving iTerm
permission to access Photos in the system settings. Worth an explicit check in the code for this scenario with a user-friendly error message perhaps?
Worked after giving iTerm permission to access Photos in the system settings. Worth an explicit check in the code for this scenario with a user-friendly error message perhaps?
I'll look into this but iTerm should have popped up a dialog asking for permission. In macOS it's the responsibility of the calling app (in this case iTerm, not Python or osxphotos which cannot, as a command line tool, request the necessary permissions). I've had problems with iTerm in the past though -- they fixed it in nightly build but I don't know if it's fixed in the regular build.
Ah, right. I had probably run some command prior to this that tried to access the photo library directory, and I had denied it. Perhaps osxphotos
can stat or touch the library directory to somehow figure out if it has permissions to access it, before going down the code paths that then fail on assumptions about reading the actual library database?
After having tried
--download-missing
unsuccessfully from an ssh session with both AppleScript and PhotoKit, I then tried on the machine itself, and got: