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

python error with MacOS #1

Open
kamil-malinski opened this issue May 22, 2023 · 4 comments
Open

python error with MacOS #1

kamil-malinski opened this issue May 22, 2023 · 4 comments

Comments

@kamil-malinski
Copy link

Hi!

I'm getting this error when I try to run main.py:

Traceback (most recent call last):
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/site-packages/pyttsx3/__init__.py", line 20, in init
    eng = _activeEngines[driverName]
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/weakref.py", line 131, in __getitem__
    o = self.data[key]()
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 23, in <module>
    engine = pyttsx3.init()
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/site-packages/pyttsx3/__init__.py", line 22, in init
    eng = Engine(driverName, debug)
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/site-packages/pyttsx3/engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/site-packages/pyttsx3/driver.py", line 52, in __init__
    self._driver = self._module.buildDriver(weakref.proxy(self))
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/site-packages/pyttsx3/drivers/nsss.py", line 9, in buildDriver
    return NSSpeechDriver.alloc().initWithProxy(proxy)
  File "/Users/admin/.pyenv/versions/3.8.16/lib/python3.8/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
@theonlyfoxy
Copy link
Collaborator

Hi.
Could you try this fix ?
RapidWareTech/pyttsx#35

@kamil-malinski
Copy link
Author

how can I apply this fix?

@theonlyfoxy
Copy link
Collaborator

Modify /Users/admin/.pyenv/versions/3.8.16/lib/python3.8/site-packages/pyttsx3/drivers/nsss.py and
Add from objc import super before from Foundation import *.

@kamil-malinski
Copy link
Author

kamil-malinski commented May 22, 2023

thanks, this fixed the issue

but it looks like pyautogui doesn't do anything

my command was "Open Firefox, open a new tab, and search for a Python tutorial."

those are the commands that the script is trying to run:

import pyautogui
import time

# Open Firefox
pyautogui.hotkey('command', 'space')
pyautogui.write('Firefox')
pyautogui.press('return')
time.sleep(2)

# Open new tab
pyautogui.hotkey('command', 't')
time.sleep(1)

# Search for Python tutorial
pyautogui.write('Python tutorial')
pyautogui.press('return')
time.sleep(3)

but nothing happens and main.py just exits

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