ronaldoussoren / pyobjc

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

support for m1 architecture based macs #573

Closed HawkingRadiation42 closed 1 year ago

HawkingRadiation42 commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] tried using pyobjc for my project and ran into an error. figured that pyobjc currently doesnt support m1 mac after going through your documentation.

request feature: title

and for the curious minds the error i found was:

objc[13803]: class `NSKVONotifying_AVCaptureConnection' not linked into application
objc[13803]: class `NSKVONotifying_AVCaptureVideoDataOutput' not linked into application
objc[13803]: class `NSKVONotifying_AVCaptureInputPort' not linked into application
objc[13803]: class `NSKVONotifying_AVCaptureDeviceInput' not linked into application
Traceback (most recent call last):
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/site-packages/pyttsx3/__init__.py", line 20, in init
    eng = _activeEngines[driverName]
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/weakref.py", line 137, in __getitem__
    o = self.data[key]()
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/shreykhandelwal/Desktop/Sign-Language-To-Text-and-Speech-Conversion/final_pred.py", line 758, in <module>
    (Application()).root.mainloop()
  File "/Users/shreykhandelwal/Desktop/Sign-Language-To-Text-and-Speech-Conversion/final_pred.py", line 36, in __init__
    self.speak_engine=pyttsx3.init()
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/site-packages/pyttsx3/__init__.py", line 22, in init
    eng = Engine(driverName, debug)
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/site-packages/pyttsx3/engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/site-packages/pyttsx3/driver.py", line 50, in __init__
    self._module = importlib.import_module(name)
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/site-packages/pyttsx3/drivers/nsss.py", line 12, in <module>
    class NSSpeechDriver(NSObject):
  File "/Users/shreykhandelwal/miniforge3/envs/unet-tf/lib/python3.10/site-packages/pyttsx3/drivers/nsss.py", line 13, in NSSpeechDriver
    @objc.python_method
NameError: name 'objc' is not defined. Did you mean: 'object'?
ronaldoussoren commented 1 year ago

My previous response through e-mail didn't work (I was traveling at the time).

PyObjC supports Apple Silicon (M-series CPUs) just fine and has supported them since they have been available, and even earlier because the port was done using developer hardware.

The error is because pyttsx3 apparently tries to use the objc module without importing it and that's a problem for that library and not for PyObjC.

HawkingRadiation42 commented 1 year ago

Thank you for your response, will check it out with pyttsx3