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

AttributeError: module 'objc' has no attribute 'initFrameworkWrapper' #508

Closed
jeanmatthieu opened this issue Nov 7, 2022 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@jeanmatthieu
Copy link

It looks like _bridgesupport.py is gone after I pip installed pyobjc 9.0 which lead to various failures such as

AttributeError: module 'objc' has no attribute 'initFrameworkWrapper'
@jeanmatthieu jeanmatthieu added the bug Something isn't working label Nov 7, 2022
@jeanmatthieu
Copy link
Author

Rolled back to 8.5.1 and that fixed the AttributeError issue

@ronaldoussoren
Copy link
Owner

I removed support for bridgesupport XML files in PyObjC 9, as mentioned in the changelog and warned about in the documentation. PyObjC itself hasn't used these XML files in a long time and the system bridgesupport files have been broken even longer.

What is your use case for using this API?

@jeanmatthieu
Copy link
Author

Hi Ronald, thanks for getting back to me.
Apologies for missing the note in the changelog, I'll make the required changes in my code.

@ronaldoussoren
Copy link
Owner

I'm still interested in knowing why you were using this API (and likely bridgesupport files) and what I can do to make that use-case easier.

@jeanmatthieu
Copy link
Author

I was loading a framework using objc.initFrameworkWrapper

import objc as
FMWK_PATH="/System/Library/PrivateFrameworks/OSPersonalization.framework"
__bundle__ = objc.initFrameworkWrapper("OSPersonalization",
                                        frameworkIdentifier="com.apple.OSPersonalization",
                                        frameworkPath=_objc.pathForFramework(FMWK_PATH),
                                        globals=globals())

I'm now using objc.loadBundle.

import objc
__bundle__ = objc.loadBundle("OSPersonalization", vars(), 
                             "/System/Library/PrivateFrameworks/OSPersonalization.framework")

I've used loadBundle before and in other places but that code was just old and hadnt been updated yet.

@schriftgestalt
Copy link

I rely on the function, too. And I need the bridgesupport file to be loaded.

The documentation is stating on several place that there are other ways to do that but there are no details about how to actually do it (only TODOs to).

So removing a vital function without providing a working replacement is a bit annoying. Only because pyobjc is not using something doesn’t mean that it not used by someone else.

ronaldoussoren added a commit that referenced this issue Nov 27, 2022
The interface is still used by 3th-party code
and keeping it around isn't too much of a hassle.

Code imported from 8.5.1, but dropping tests for
bridgesupport files in system frameworks.

Issue #508
@ronaldoussoren
Copy link
Owner

@schriftgestalt, I've reverted the removal for (at least) the 9.x release and will keep it around until the replacement is ready for general use. My plan was to have this done before the 9.0 release, but sadly I never got around to this and the tooling I'm using for PyObjC is not useable for anything but system frameworks.

I'm not sure yet when I'll push out 9.0.1, probably sometime during the coming week.

@schriftgestalt
Copy link

Thanks

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

3 participants