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: 'super' object has no attribute 'init' sys:1: UninitializedDeallocWarning: leaking an uninitialized object of type NSSpeechDriver #70

Open
anshtyagi0 opened this issue Jun 8, 2023 · 1 comment

Comments

@anshtyagi0
Copy link

anshtyagi0 commented Jun 8, 2023

I was making a personal assistant I got a error in starting
code:

import pyttsx3
engine = pyttsx3.init()
engine.say('How are you today?')
engine.runAndWait()

Error:

/usr/local/lib/python3.11/site-packages/pyttsx3/drivers/nsss.py:12: ObjCSuperWarning: Objective-C subclass uses super(), but super is not objc.super
  class NSSpeechDriver(NSObject):
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyttsx3/__init__.py", line 20, in init
    eng = _activeEngines[driverName]
          ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/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/anshtyagi/Documents/personal assistant/main.py", line 5, in <module>
    engine = pyttsx3.init()
             ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyttsx3/__init__.py", line 22, in init
    eng = Engine(driverName, debug)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyttsx3/engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyttsx3/driver.py", line 52, in __init__
    self._driver = self._module.buildDriver(weakref.proxy(self))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyttsx3/drivers/nsss.py", line 9, in buildDriver
    return NSSpeechDriver.alloc().initWithProxy(proxy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyttsx3/drivers/nsss.py", line 15, in initWithProxy
    self = super(NSSpeechDriver, self).init()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'super' object has no attribute 'init'
sys:1: UninitializedDeallocWarning: leaking an uninitialized object of type NSSpeechDriver

I don't know what is the problem one more thing due to some issue I has to uninstall old python version on Mac and installed new one using Homebrew.

Mac OS ventura 13.4

Python 3.11

@usersina
Copy link

I am also facing the same problem. It appears that the following fixes it, but my script immediately terminates after engine.runAndWait().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants