Closed ganeshnikhil closed 2 weeks ago
same for me.
same for me as well
Installing this package solved the challenge for me.
thanks @onyekaokonji this worked for me
I was experiencing the same issue, and that seemed to resolve that issue.
Now I received a new error (below). Do you have an idea on how to address?
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/init.py", line 20, in init eng = _activeEngines[driverName]
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/weakref.py", line 136, in __getitem__
o = self.data[key]()
~~~~~~~~~^^^^^
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/drewpeterson/Documents/Programming/Python/CS50/speech.py", line 6, in <module>
engine = pyttsx3.init()
^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/driver.py", line 50, in __init__
self._module = importlib.import_module(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 2, in <module>
from Foundation import *
File "<frozen importlib._bootstrap>", line 1403, in _handle_fromlist
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/objc/_lazyimport.py", line 160, in __getattr__
value = self.__calc_all()
^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/objc/_lazyimport.py", line 328, in __calc_all
all_names.update(p.__all__)
^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/objc/_lazyimport.py", line 160, in __getattr__
value = self.__calc_all()
^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/objc/_lazyimport.py", line 257, in __calc_all
objc.loadBundleVariables(self.__bundle, dct, varmap)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/objc/_pythonify.py", line 52, in numberWrapper
if isinstance(obj, NSDecimalNumber):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
objc.internal_error: PyObjC: internal error in _type_lookup at Modules/objc/objc-object.m:380: assertion failed: dict && PyDict_Check(dict)
Installing this package solved the challenge for me.
This worked for me as well. Thanks a lot
Installing this package solved the challenge for me.
This worked for me as well, however the single line speak
command does not work , so must set up engine and use the say
command.
Installing this package solved the challenge for me.
这个有用
Still not working for me. ` Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/init.py", line 24, in init eng = _activeEngines[driverName]
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/weakref.py", line 136, in __getitem__
o = self.data[key]()
~~~~~~~~~^^^^^
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/__init__.py", line 27, in init
eng = Engine(driverName=driverName, debug=debug)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/engine.py", line 32, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/driver.py", line 51, in __init__
self._module = importlib.import_module(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 35, in <module>
class NSSpeechDriver(NSObject):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 42, in NSSpeechDriver
@objc.python_method
^^^^
NameError: name 'objc' is not defined. Did you mean: 'object'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user/Desktop/tty.py", line 5, in <module>
engine = pyttsx3.init()
^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyttsx3/__init__.py", line 31, in init
raise RuntimeError("\n\nUnable to load driver '%s'" % driverName)
RuntimeError:
Unable to load driver 'None'
`
i am using pyttsx3 on macos and python version that i am using is 3.9.0 64bit . i am getting this error on both imac and mac book air .
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/init.py", line 20, in init eng = _activeEngines[driverName] File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/weakref.py", line 134, in getitem o = self.datakey KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/Shared/python_code/youtube_summarizer/test.py", line 15, in text_to_speech(text) File "/Users/Shared/python_code/youtube_summarizer/test.py", line 5, in text_to_speech speaker = pyttsx3.init() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/init.py", line 22, in init eng = Engine(driverName, debug) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/driver.py", line 50, in init self._module = importlib.import_module(name) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py", line 12, in class NSSpeechDriver(NSObject): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py", line 13, in NSSpeechDriver @objc.python_method NameError: name 'objc' is not defined
try to uninstall you pyobjc then install 9.X version, see if it works
第一步:pip install pyttsx4 第二步:修改 xxxxxxx/site-packages/pyttsx4/drivers/nsss.py 文件,在头部添加代码 import objc 这样就可以正常工作了~
Personally pyttsx4 deviates quite a bit - the coqui stuff is ok. but its a bit of a overhead - this is cleaner IMHO https://github.com/thevickypedia/py3-tts (although they could do with stating its a fork)
Installing this package solved the challenge for me.
cool ! it works success on my mac machine!
I faced the same issue and it drove me crazy until I got here. Thanks, guys.
updated docs to address this and merged many bug fix PRs and published the library. if the issue persists, pls raise another issue.
i am using pyttsx3 on macos and python version that i am using is 3.9.0 64bit . i am getting this error on both imac and mac book air .
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/init.py", line 20, in init eng = _activeEngines[driverName] File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/weakref.py", line 134, in getitem o = self.data[key]() KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/Shared/python_code/youtube_summarizer/test.py", line 15, in
text_to_speech(text)
File "/Users/Shared/python_code/youtube_summarizer/test.py", line 5, in text_to_speech
speaker = pyttsx3.init()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/init.py", line 22, in init
eng = Engine(driverName, debug)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/driver.py", line 50, in init
self._module = importlib.import_module(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py", line 12, in
class NSSpeechDriver(NSObject):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py", line 13, in NSSpeechDriver
@objc.python_method
NameError: name 'objc' is not defined