RapidWareTech / pyttsx

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

ImportError: No module named Foundation #37

Open snailrowen opened 8 years ago

snailrowen commented 8 years ago

Hi Everybody, I have installed pyttsx but I can't get it to work. For some reason I need the module "Fondation" which I do not have. I'm using OS 10.10, and when I try to execute script using pyttsx functions I get the error below. I'm not sure what to do, any help would be greatly appreciated!

/Users/johanbjorck/.bashrc: line 1: p: command not found Traceback (most recent call last): File "/Users/johanbjorck/Google Drive/Sublime/earsight/pyttsx_test.py", line 3, in engine = pyttsx.init() File "/usr/local/lib/python2.7/site-packages/pyttsx/init.py", line 39, in init eng = Engine(driverName, debug) File "/usr/local/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/usr/local/lib/python2.7/site-packages/pyttsx/driver.py", line 64, in init self._module = import(name, globals(), locals(), [driverName]) File "/usr/local/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 18, in from Foundation import * ImportError: No module named Foundation [Finished in 0.1s with exit code 1] [shell_cmd: python -u "/Users/johanbjorck/Google Drive/Sublime/earsight/pyttsx_test.py"] [dir: /Users/johanbjorck/Google Drive/Sublime/earsight] [path: /usr/bin:/bin:/usr/sbin:/sbin]

spreadred commented 8 years ago

Try installing the Foundation module? Perhaps this is it?https://pypi.python.org/pypi/Foundations/2.1.0

-------- Original message -------- From: snailrowen notifications@github.com Date: 1/11/2016 10:45 AM (GMT-05:00) To: parente/pyttsx pyttsx@noreply.github.com Subject: [pyttsx] ImportError: No module named Foundation (#37)

Hi Everybody, I have installed pyttsx but I can't get it to work For some reason I need the module "Fondation" which I do not have I'm using OS 1010, and when I try to execute script using pyttsx functions I get the error below I'm not sure what to do, any help would be greatly appreciated!

/Users/johanbjorck/bashrc: line 1: p: command not found

Traceback (most recent call last):

File "/Users/johanbjorck/Google Drive/Sublime/earsight/pyttsx_testpy", line 3, in

engine = pyttsxinit()

File "/usr/local/lib/python27/site-packages/pyttsx/init__py", line 39, in init

eng = Engine(driverName, debug)

File "/usr/local/lib/python27/site-packages/pyttsx/enginepy", line 45, in __init

selfproxy = driverDriverProxy(weakrefproxy(self), driverName, debug)

File "/usr/local/lib/python27/site-packages/pyttsx/driverpy", line 64, in init

self_module = import(name, globals(), locals(), [driverName])

File "/usr/local/lib/python27/site-packages/pyttsx/drivers/nssspy", line 18, in

from Foundation import *

ImportError: No module named Foundation

[Finished in 01s with exit code 1]

[shell_cmd: python -u "/Users/johanbjorck/Google Drive/Sublime/earsight/pyttsx_testpy"]

[dir: /Users/johanbjorck/Google Drive/Sublime/earsight]

[path: /usr/bin:/bin:/usr/sbin:/sbin]

— Reply to this email directly or view it on GitHub.

snailrowen commented 8 years ago

Hmm it didn't work, the link you said was for "Foundations" but I'm missing "Foundation". Any other bets?

spreadred commented 8 years ago

I don't run macosx so I'm making guesses. Have you looked at and tried this?  http://stackoverflow.com/questions/3098932/importerror-no-module-named-foundation The user added the directory in which foundation resides to the python path.

-------- Original message -------- From: snailrowen notifications@github.com Date: 1/12/2016 11:03 AM (GMT-05:00) To: parente/pyttsx pyttsx@noreply.github.com Cc: kaptainkommie rohn.adams@gmail.com Subject: Re: [pyttsx] ImportError: No module named Foundation (#37)

Hmm it didn't work, the link you said was for "Foundations" but I'm missing "Foundation". Any other bets?

— Reply to this email directly or view it on GitHub.

snailrowen commented 8 years ago

Thanks a lot. I tried adding that to my python path, but it still didn't work. Is there any other approach, or should I simply find another program?

blacksector commented 8 years ago

@snailrowen Try taking a look here: ImportError: No module named Foundation

cainesap commented 8 years ago

@snailrowen Did you solve this? I had the same problem, the 'Foundation' error message when using 'main' Python (2.7) on Mac OS X 10.11 and trying to import pyttsx. But having set up a virtual environment with the --system-site-packages flag, I get one step further: I can import pyttsx without complaint about Foundation. But then see the following traceback in trying to define engine:

$ import pyttsx $ engine = pyttsx.init() Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/init.py", line 39, in init eng = Engine(driverName, debug) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/driver.py", line 66, in init self._driver = self._module.buildDriver(weakref.proxy(self)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 24, in buildDriver return NSSpeechDriver.alloc().initWithProxy(proxy) File "/Library/Frameworks/Python.framework/Versions/2.7/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'

foges commented 8 years ago

I ended up having to install pyobjc from top of tree, but now I get this error:

>>> import pyttsx
>>> engine = pyttsx.init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/__init__.py", line 39, in init
    eng = Engine(driverName, debug)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/driver.py", line 64, in __init__
    self._module = __import__(name, globals(), locals(), [driverName])
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 26, in <module>
    class NSSpeechDriver(NSObject):
objc.BadPrototypeError: Objective-C expects 1 arguments, Python argument has 3 arguments for <unbound selector setProperty of NSSpeechDriver at 0x1088f4f38>

Any ideas?

ideasotw commented 8 years ago

Hmm nothing on this topic seems to work. Does anyone know what is actually coursing this? Thanks

jhonnydv commented 7 years ago

I am getting the following error. I am running this code on mac. Traceback (most recent call last): File "driver_event.py", line 2, in engine = pyttsx.init() File "/usr/local/lib/python2.7/site-packages/pyttsx/init.py", line 39, in init eng = Engine(driverName, debug) File "/usr/local/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/usr/local/lib/python2.7/site-packages/pyttsx/driver.py", line 64, in init self._module = import(name, globals(), locals(), [driverName]) File "/usr/local/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 26, in class NSSpeechDriver(NSObject): objc.BadPrototypeError: Objective-C expects 1 arguments, Python argument has 2 arguments for <unbound selector _toVoice of NSSpeechDriver at 0x1105f4cc8>

cynliu98 commented 7 years ago

I'm having the same error as anjandv

Mwarukason commented 7 years ago

I got same error too, so how.?

Randy808 commented 7 years ago

I'm also getting the error. Does anyone know any known configuration of Python this library works with?

bolin-hsu commented 7 years ago

On OS X El Capitan version 10.11.3, I encountered this issue. I used the following workaround: export PYTHONPATH="/System/Library/Frameworks/Python.framework//Versions/2.7/Extras/lib/python/PyObjC"

JoshuaCalder commented 7 years ago

Thanks @bolin-hsu ! Worked great for me. I had to first install Pyobc and then your workaround solved the issue.

praveen-1 commented 7 years ago

@JoshCalder That solution didn't work for me. Did you install anything else?

k-ksharma commented 7 years ago

@JoshuaCalder i was having the foundation error too on mac. I'm using Sierra OS. I resolved the foundation error by runnning it in a virtual environment and it works without any error. But in virtual environment, i'm unable to simulate function key. Installing PyObjc creates this error. Can anyone help me ?

rishabhbhardwaj commented 7 years ago

@sharma16aug I am using virtualenv in macOS Sierra. I installed PyObjc but still getting the below error.

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    speech_engine = pyttsx.init()
  File "/Users/r0b00ko/.virtualenvs/test-assistent/lib/python2.7/site-packages/pyttsx/__init__.py", line 39, in init
    eng = Engine(driverName, debug)
  File "/Users/r0b00ko/.virtualenvs/test-assistent/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "/Users/r0b00ko/.virtualenvs/test-assistent/lib/python2.7/site-packages/pyttsx/driver.py", line 64, in __init__
    self._module = __import__(name, globals(), locals(), [driverName])
  File "/Users/r0b00ko/.virtualenvs/test-assistent/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 18, in <module>
    from Foundation import *
ImportError: No module named Foundation
k-ksharma commented 7 years ago

@rishabhbhardwaj pyobjc might have some error with it. before installing pyobjc pyttsx was running fine. but now fro my poject i left this module and switched to mac default speakers. instead of using pyttsx you can use the inbuilt module to transform text into speech.

use this :

from os import system system('say hello world) system('say -v Alex hello world)

these work perfectly.

jackpgao commented 7 years ago

‘ImportError: No module named Foundation’

Still have the same problem.

pkworlz commented 6 years ago

need help, getting this error on my mac.

Traceback (most recent call last): File "texttospeach.py", line 2, in engine = pyttsx.init() File "/usr/local/lib/python2.7/site-packages/pyttsx/init.py", line 39, in init eng = Engine(driverName, debug) File "/usr/local/lib/python2.7/site-packages/pyttsx/engine.py", line 45, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/usr/local/lib/python2.7/site-packages/pyttsx/driver.py", line 64, in init self._module = import(name, globals(), locals(), [driverName]) File "/usr/local/lib/python2.7/site-packages/pyttsx/drivers/nsss.py", line 18, in from Foundation import * ImportError: No module named Foundation

Datartic commented 6 years ago

@cainesap I got an error regarding NSObject.To resolve this in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages.., replace pyttsx3 with my attached file or Any resolved pyttsx3 file from git hub(I have attached a link file) https://github.com/nateshmbhat/pyttsx3 paste this pyttsx3 extracted file in the place of old..which solved for me.

packeteer commented 6 years ago

pip install pyobjc <- solved it for me

missmint27 commented 6 years ago

On OS X El Capitan version 10.11.3, I encountered this issue. I used the following workaround: export PYTHONPATH="/System/Library/Frameworks/Python.framework//Versions/2.7/Extras/lib/python/PyObjC"

I just found that I am not installed pyobjc

TheDarkEyezor commented 2 years ago

I already installed pyobjc. Still doesn't work for me. I've tried everything on this thread. Has anyone found a solution?

ravicont1998 commented 1 year ago

go to the location of site-packages

there you will have a folder named foundation.

do - >renaming

sudo mv foundation/ Foundation/

this worked for me