RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2.16k stars 100 forks source link

Framework UniformTypeIdentifiers could not be found #1680

Open drodner opened 2 months ago

drodner commented 2 months ago

When running the latest version of osxphotos, I get the following error: ImportError: Framework UniformTypeIdentifiers could not be found

I tried doing the pipx upgrade osxphotos, but still get the issue. I also tried uninstall and reinstall but that did not solve it either. No parameters are necessary to cause the issue. Just type osxphotos.

Version of MacOS is 10.15.7. Full call stack is:

Lori@LoriMac ~ % osxphotos Traceback (most recent call last): File "/Users/Lori/.local/bin/osxphotos", line 5, in from osxphotos.main import cli_main File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/main.py", line 3, in from .cli.cli import cli_main File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/init.py", line 48, in from .albums import albums File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/albums.py", line 12, in from .cli_params import DB_ARGUMENT, DB_OPTION, JSON_OPTION File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/cli_params.py", line 14, in from .param_types import * File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/param_types.py", line 17, in from osxphotos.export_db_utils import export_db_get_version File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/export_db_utils.py", line 25, in from .photo_signature import photo_signature File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/photo_signature.py", line 10, in from .photoinfo_file import PhotoInfoFromFile File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/photoinfo_file.py", line 21, in from .image_file_utils import is_image_file, is_video_file File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/image_file_utils.py", line 19, in import cgmetadata File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/cgmetadata/init.py", line 4, in from .classes import ImageMetadata, ImageMetaData, VideoMetadata, VideoMetaData File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/cgmetadata/classes.py", line 6, in from .cgmetadata import ( File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/cgmetadata/cgmetadata.py", line 28, in from .xmp import is_xmp_packet, metadata_dictionary_from_xmp_packet File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/cgmetadata/xmp.py", line 13, in from .utils import single_quotes_to_double_quotes, strip_xmp_packet File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/cgmetadata/utils.py", line 10, in import UniformTypeIdentifiers File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/UniformTypeIdentifiers/init.py", line 17, in objc.pathForFramework( File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/objc/_dyld.py", line 142, in pathForFramework fpath, name, version = infoForFramework(dyld_find(path)) ^^^^^^^^^^^^^^^ File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/objc/_dyld.py", line 136, in dyld_find return dyld_framework(filename, framework_name, version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/objc/_dyld.py", line 102, in dyld_framework raise ImportError(f"Framework {framework_name} could not be found") ImportError: Framework UniformTypeIdentifiers could not be found Lori@LoriMac ~ %

RhetTbull commented 2 months ago

The UTI APIs changed on macOS 11 and UniformTypeIdentifiers is only available on macOS 11+. Looks like the dependency cgmetadata, which I also maintain, is the issue. I have an old machine running 10.15.7 I can dig up and do some testing to see if I can work around this. If not I may need to drop support for macOS 10.15.7.

drodner commented 2 months ago

OK. I appreciate you checking into that. If not, what's the most recent version that would work on 10.15.7? And is it possible using pipx to revert to that specific version? Thanks!

RhetTbull commented 1 month ago

I think 0.67.10 should work. You can use pipx install osxphotos==0.67.10

RhetTbull commented 1 month ago

I think this should be fixed in 0.68.6 but I've not been able to test it on 10.15 to verify.

drodner commented 1 month ago

Unfortunately, 0.68.6 did not fix it. Similar stack trace:

Lori@LoriMac ~ % pipx upgrade osxphotos upgraded package osxphotos from 0.68.5 to 0.68.6 (location: /Users/Lori/.local/pipx/venvs/osxphotos) Lori@LoriMac ~ % osxphotos Traceback (most recent call last): File "/Users/Lori/.local/bin/osxphotos", line 5, in from osxphotos.main import cli_main File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/main.py", line 3, in from .cli.cli import cli_main File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/init.py", line 48, in from .albums import albums File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/albums.py", line 12, in from .cli_params import DB_ARGUMENT, DB_OPTION, JSON_OPTION File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/cli_params.py", line 14, in from .param_types import * File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/cli/param_types.py", line 17, in from osxphotos.export_db_utils import export_db_get_version File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/export_db_utils.py", line 25, in from .photo_signature import photo_signature File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/photo_signature.py", line 10, in from .photoinfo_file import PhotoInfoFromFile File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/photoinfo_file.py", line 21, in from .image_file_utils import is_image_file, is_video_file File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/image_file_utils.py", line 33, in from UniformTypeIdentifiers import UTType, UTTypeImage, UTTypeMovie File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/UniformTypeIdentifiers/init.py", line 17, in objc.pathForFramework( File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/objc/_dyld.py", line 142, in pathForFramework fpath, name, version = infoForFramework(dyld_find(path)) ^^^^^^^^^^^^^^^ File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/objc/_dyld.py", line 136, in dyld_find return dyld_framework(filename, framework_name, version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Lori/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/objc/_dyld.py", line 102, in dyld_framework raise ImportError(f"Framework {framework_name} could not be found") ImportError: Framework UniformTypeIdentifiers could not be found Lori@LoriMac ~ %

RhetTbull commented 1 month ago

Thanks for the feedback. I'll take a look when I get a chance.

RhetTbull commented 1 month ago

I've created a new library, utitools that implements the needed functionality across macOS versions and linux. I need to test this on 10.15 then I'll refactor osxphotos to use this which should resolve the issue.