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

ImportError: No module named Foundation #37

Open
snailrowen opened this issue Jan 11, 2016 · 25 comments
Open

ImportError: No module named Foundation #37

snailrowen opened this issue Jan 11, 2016 · 25 comments

Comments

@snailrowen
Copy link

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
Copy link

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

-------- Original message --------
From: snailrowen [email protected]
Date: 1/11/2016 10:45 AM (GMT-05:00)
To: parente/pyttsx [email protected]
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
Copy link
Author

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

@spreadred
Copy link

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 [email protected]
Date: 1/12/2016 11:03 AM (GMT-05:00)
To: parente/pyttsx [email protected]
Cc: kaptainkommie [email protected]
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
Copy link
Author

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
Copy link

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

@cainesap
Copy link

@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
Copy link

foges commented Jul 28, 2016

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
Copy link

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

@jhonnydv
Copy link

jhonnydv commented Jan 9, 2017

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
Copy link

I'm having the same error as anjandv

@Mwarukason
Copy link

I got same error too, so how.?

@Randy808
Copy link

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

@bolin-hsu
Copy link

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
Copy link

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

@praveen-1
Copy link

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

@k-ksharma
Copy link

k-ksharma commented Apr 4, 2017

@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
Copy link

@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
Copy link

@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
Copy link

jackpgao commented Aug 1, 2017

‘ImportError: No module named Foundation’

Still have the same problem.

@pkworlz
Copy link

pkworlz commented Dec 28, 2017

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
Copy link

Datartic commented Feb 7, 2018

@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
Copy link

pip install pyobjc <- solved it for me

@missmint27
Copy link

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
Copy link

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

@ravicont1998
Copy link

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

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