RapidWareTech / pyttsx

Cross-platform text-to-speech wrapper
Other
370 stars 134 forks source link

NSSpeechDriver: 'super' object has no attribute 'init' #33

Open iuga opened 9 years ago

iuga commented 9 years ago

Hi All ! I grab this code from the examples:

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

but is failing with a:

Traceback (most recent call last):
  File "run.py", line 2, in <module>
    engine = pyttsx.init()
  File ".../venv/lib/python2.7/site-packages/pyttsx/__init__.py", line 39, in init
    eng = Engine(driverName, debug)
  File ".../venv/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File ".../venv/lib/python2.7/site-packages/pyttsx/driver.py", line 66, in __init__
    self._driver = self._module.buildDriver(weakref.proxy(self))
  File ".../venv/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 24, in buildDriver
    return NSSpeechDriver.alloc().initWithProxy(proxy)
  File ".../venv/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 28, in initWithProxy
    self = super(NSSpeechDriver, self).init()
AttributeError: 'super' object has no attribute 'init'

Running it on:

OSX Yosemite 10.10.3
Python 2.7.6
pyobjc==3.0.4
pyobjc-core==3.0.4
pyttsx==1.1

Any thoughts ? Any help will be really appreciated !

uranusjr commented 9 years ago

It seems like that this is a problem in PyObjC. I raised this problem and was offered a solution.

This problem does not exist with the pyobjc and Python shipped with OS X, so it is either a problem with PyObjC 3.x, or a non-built-in Python installation. Unfortunately I am not able to build PyObjC on 10.10 to verify either.

ghost commented 9 years ago

Hi uranusjr, thanks for the above solution, I can confirm it works on homebrew Python 2.7.9

anshtyagi0 commented 1 year ago

Having same issue Python 3.11.3 installed using arch -x86_64 brew

anshtyagi0 commented 1 year ago

@uranusjr

usersina commented 1 year ago

Same issue with python 3.11.5 on Ventura 13.5.1 (22G90)