ronaldoussoren / pyobjc

The Python <-> Objective-C Bridge with bindings for macOS frameworks
https://pyobjc.readthedocs.io
553 stars 47 forks source link

pyobjc 10.3: `module 'objc' has no attribute 'registerNewKeywordsFromSelector'` #611

Closed totaam closed 3 months ago

totaam commented 3 months ago

Where is registerNewKeywordsFromSelector meant to be defined? What am I missing?

% python -c "import Quartz"                                                       
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/Quartz/__init__.py", line 47, in <module>
    globals().pop("_setup")()
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/Quartz/__init__.py", line 7, in _setup
    import AppKit
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/AppKit/__init__.py", line 217, in <module>
    globals().pop("_setup")()
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/AppKit/__init__.py", line 12, in _setup
    import Foundation
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/Foundation/__init__.py", line 203, in <module>
    globals().pop("_setup")()
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/Foundation/__init__.py", line 14, in _setup
    from . import _Foundation, _metadata, _functiondefines, _context
  File "/Users/macos12/gtk/inst/lib/python3.11/site-packages/Foundation/_metadata.py", line 11156, in <module>
    objc.registerNewKeywordsFromSelector("NSAffineTransform", b"initWithTransform:")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'objc' has no attribute 'registerNewKeywordsFromSelector'
ronaldoussoren commented 3 months ago

What versions of the various pyobjc packages are installed? This looks like having an older version of pyobjc-core installed.

totaam commented 3 months ago

I fully expected this to be an embarrassing case of me messing up somewhere. And it indeed it was, a typo: https://github.com/Xpra-org/gtk-osx-build/commit/b429c6ad3112d50bd20f9e1d3efaccf3e369815b Sorry for wasting your time!

FYI, this came about because the packages on pypi use a different spelling: https://github.com/Xpra-org/gtk-osx-build/commit/eead1526ba22357098808ad66875632231c0dc47 Which may have happened when we switched to the short URLs (I haven't checked): https://github.com/Xpra-org/gtk-osx-build/commit/78190541252a6de85f0558112dad2b5d6de4b585

ronaldoussoren commented 3 months ago

FYI, this came about because the packages on pypi use a different spelling: Xpra-org/gtk-osx-build@eead152 Which may have happened when we switched to the short URLs (I haven't checked): Xpra-org/gtk-osx-build@7819054

That's the filename normalisation used for distribution archives which escapes some characters, such as a minus sign, in distribution names when calculating the archive filename for a distribution artefact (see https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode for more details on this)