i was trying to get audio output using pyttsx3 in python
here is the code:
import pyttsx3
def speak(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
speak("hello world")
It is throwing handling errors which i am not able to understand:
Traceback (most recent call last):
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3_init_.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\weakref.py", line 137, in getitem
o = self.datakey
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 121, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.automation.LP_tagVARIANT'>, <class 'ctypes.c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Learning/100dayscode/python/voice.py", line 132, in <module>
speak("Hello ")
File "D:/Learning/100dayscode/python/voice.py", line 23, in speak
engine = pyttsx3.init()
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 24, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 365, in <module>
( ['out', 'retval'], POINTER(POINTER(ISpeechObjectTokens)), 'ObjectTokens' )),
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 329, in __setattr__
self._make_methods(value)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\harshit\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
Well i figured it out.
It looks like the new version of pip have conflicts with updates.
This code worked for me
python -m pip install pyttsx3==2.71
Related
I am using python 3.8 as the lambda runtime for my lambda function which I am trying to deploy using cdk v2. This is a lambda as a custom resource that runs every time the stack deploys.
This is the folder structure
/Dynamics/cust_resource/__init__.py
/Dynamics/cust_resource/data_objects.py
/Dynamics/cust_resource/lambda.py
/Dynamics/cust_resource/requirements.txt
/Dynamics/__init__.py
/Dynamics/dyna_stack.py
app.py
This is the lambda code
import os
import boto3
import sys
print('before lambda import')
from data_objects import poco_data
This is how I am creating the function in the stack
cust_res_lambda = _lambda.Function(
self, 'crLambda',
runtime=_lambda.Runtime.PYTHON_3_8,
code=_lambda.Code.from_asset('Dynamics/cust_resource',
bundling=BundlingOptions(
image=_lambda.Runtime.PYTHON_3_8.bundling_image,
command=["bash", "-c", "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output"]
)),
handler='lambda.lambda_handler',
function_name='crlambdaFn',
)
The lambda executes and I see the line before lambda import in cloudwatch logs followed by.
[ERROR] RuntimeError: generator didn't stop after throw()
Traceback (most recent call last):
File "/var/lang/lib/python3.8/imp.py", line 234, in load_module
return load_source(name, filename, file)
File "/var/lang/lib/python3.8/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/task/lambda.py", line 12, in <module>
from data_objects import poco_data
File "/var/task/data_objects.py", line 1, in <module>
from aws_cdk import (
File "/var/task/aws_cdk/__init__.py", line 1257, in <module>
from ._jsii import *
File "/var/task/aws_cdk/_jsii/__init__.py", line 13, in <module>
import constructs._jsii
File "/var/task/constructs/__init__.py", line 43, in <module>
from ._jsii import *
File "/var/task/constructs/_jsii/__init__.py", line 13, in <module>
__jsii_assembly__ = jsii.JSIIAssembly.load(
File "/var/task/jsii/_runtime.py", line 54, in load
_kernel.load(assembly.name, assembly.version, os.fspath(assembly_path))
File "/var/lang/lib/python3.8/contextlib.py", line 162, in __exit__
raise RuntimeError("generator didn't stop after throw()")
[ERROR] RuntimeError: generator didn't stop after throw() Traceback (most recent call last): File "/var/lang/lib/python3.8/imp.py", line 234, in load_module return load_source(name, filename, file) File "/var/lang/lib/python3.8/imp.py", line 171, in load_source module = _load(spec) File "<frozen importlib._bootstrap>", line 702, in _load File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 843, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/var/task/lambda.py", line 12, in <module> from data_objects import poco_data File "/var/task/data_objects.py", line 1, in <module> from aws_cdk import ( File "/var/task/aws_cdk/__init__.py", line 1257, in <module> from ._jsii import * File "/var/task/aws_cdk/_jsii/__init__.py", line 13, in <module> import constructs._jsii File "/var/task/constructs/__init__.py", line 43, in <module> from ._jsii import * File "/var/task/constructs/_jsii/__init__.py", line 13, in <module> __jsii_assembly__ = jsii.JSIIAssembly.load( File "/var/task/jsii/_runtime.py", line 54, in load _kernel.load(assembly.name, assembly.version, os.fspath(assembly_path)) File "/var/lang/lib/python3.8/contextlib.py", line 162, in __exit__ raise RuntimeError("generator didn't stop after throw()")
What does this error mean and how to fix it?
how to init pyttsx3 in pydroid3
when i tried to init it is raising OSError
can anyone help to solve this code
i tried this code
import pyttsx3
engine = pyttsx3.init()
engine.say("hello world")
engine.runAndWait()
but it raised this error
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module> start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "<string>", line 2, in <module>
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/pyttsx3/driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/pyttsx3/drivers/espeak.py", line 9, in <module>
from . import _espeak, toUtf8, fromUtf8
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/pyttsx3/drivers/_espeak.py", line 18, in <module>
dll = cdll.LoadLibrary('libespeak.so.1')
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen failed: library "libespeak.so.1" not found
how to solve this error?
do anyone knows how to solve this error?
To be honest, there is a way around this error, which is to put 'dummy' in init() inside the parentheses. It is not a big deal, since it will still not work, at least it removes the error (I say it in my case).
the title says all mostly, i'e been trying to make this package named chatterbot to work and then it shows this, i'm running ubuntu focal fossa
Full error log:
<frozen importlib._bootstrap>:219: RuntimeWarning: thinc.extra.search.Beam size changed, may indicate binary incompatibility. Expected 112 from C header, got 120 from PyObject
Traceback (most recent call last):
File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 70, in get_lang_class
module = importlib.import_module(".lang.%s" % lang, "spacy")
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/arman/.local/lib/python3.8/site-packages/spacy/lang/en/__init__.py", line 15, in <module>
from ...language import Language
File "/home/arman/.local/lib/python3.8/site-packages/spacy/language.py", line 17, in <module>
from .pipeline import DependencyParser, Tagger
File "/home/arman/.local/lib/python3.8/site-packages/spacy/pipeline/__init__.py", line 4, in <module>
from .pipes import Tagger, DependencyParser, EntityRecognizer, EntityLinker
File "pipes.pyx", line 17, in init spacy.pipeline.pipes
File "/home/arman/.local/lib/python3.8/site-packages/spacy/pipeline/functions.py", line 4, in <module>
from ..matcher import Matcher
ModuleNotFoundError: No module named 'spacy.matcher'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 4, in <module>
bot = ChatBot('Test')
File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/chatterbot.py", line 28, in __init__
File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/utils.py", line 33, in initialize_class
File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/storage/sql_storage.py", line 20, in __init__
File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/storage/storage_adapter.py", line 22, in __init__
File "/usr/local/lib/python3.8/dist-packages/ChatterBot-1.1.0a7-py3.8.egg/chatterbot/tagging.py", line 26, in __init__
File "/home/arman/.local/lib/python3.8/site-packages/spacy/__init__.py", line 27, in load
return util.load_model(name, **overrides)
File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 132, in load_model
return load_model_from_link(name, **overrides)
File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 149, in load_model_from_link
return cls.load(**overrides)
File "/home/arman/.local/lib/python3.8/site-packages/spacy/data/en/__init__.py", line 12, in load
return load_model_from_init_py(__file__, **overrides)
File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 196, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 166, in load_model_from_path
cls = get_lang_class(lang)
File "/home/arman/.local/lib/python3.8/site-packages/spacy/util.py", line 72, in get_lang_class
raise ImportError(Errors.E048.format(lang=lang, err=err))
ImportError: [E048] Can't import language en from spacy.lang: No module named 'spacy.matcher'
I've tried all the other solutions on the internet none of them worked, it's been so many hours i don't even remember them all please forgive me
I don't Know what just happened or what was the problem but i fixed it, in case anyone encounters the issue i'll leave it here
Get spacy from github
Install everything on the requirements file
Install spacy from source
It's fixed somehow...
While using the pyttsx3 module in my python 3.8.5 virtual environment by this code:
import pyttsx3
def speak(speak):
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
engine.getProperty('rate')
engine.setProperty('rate', 155)
engine.say(speak)
engine.runAndWait()
speak("Hello")
I'm getting this error on compilation of the above code:
Traceback (most recent call last):
File "D:\virtualenv\venv\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "c:\users\CurrentUser\appdata\local\programs\python\python38-32\lib\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 "d:/virtualenv/hehe.py", line 12, in <module>
speak("Hello")
File "d:/virtualenv/hehe.py", line 4, in speak
engine = pyttsx3.init()
File "D:\virtualenv\venv\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "D:\virtualenv\venv\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "D:\virtualenv\venv\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "c:\users\CurrentUser\appdata\local\programs\python\python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 1, in <module>
import comtypes.client # Importing comtypes.client will make the gen subpackage
File "D:\virtualenv\venv\lib\site-packages\comtypes\__init__.py", line 1176, in <module>
class IPersist(IUnknown):
File "D:\virtualenv\venv\lib\site-packages\comtypes\__init__.py", line 1180, in IPersist
COMMETHOD([], HRESULT, 'GetClassID',
File "D:\virtualenv\venv\lib\site-packages\comtypes\__init__.py", line 1099, in COMMETHOD
from comtypes.automation import VARIANT
File "D:\virtualenv\venv\lib\site-packages\comtypes\automation.py", line 4, in <module>
import decimal
File "c:\users\CurrentUser\appdata\local\programs\python\python38-32\lib\decimal.py", line 3, in <module>
from _decimal import *
AttributeError: module 'numbers' has no attribute 'Number'
Everytime I run the given python code, the above error occurs and I'm using VS code as my coding IDE in Windows 10
Take the pyttsx3.init() out of the function. It is not to called repeateadly. It is to be called only once.
import pyttsx3
engine = pyttsx3.init()
def speak(word):
#set engine properties
engine.say(word)
engine.runAndWait()
speak('Speak')
This should work:
import pyttsx3
engine = pyttsx3.init()
def speak(word):
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
rate = engine.getProperty('rate')
engine.setProperty('rate', 155)
engine.say(word)
engine.runAndWait()
speak("Hello")
Difficulty in using pyttsx3 in windows and rasbian with python 3.8 and 2.7 respectively
when i am trying to run a simple basic pyttsx3 code it is giving an error and please suggest replacement for this package.I am trying to develop a personal assistant and i need pyttsx3 module to work. On all the tutorials about pyttsx3 it works fine without any error but with python 3.8 it is giving error. I tried using this package in windows as well as raspbian and the error is same in both the cases.
Here is a piece of code that i am trying to execute and i have all necessary module installed pywin32,pyttsx3,pyaudio,speechrecognition everything.
import pyttsx3
**engine = pyttsx3.init()
engine.say('Hello sir, how may I help you, sir.')
engine.runAndWait()**
*it is giving error as:*
Traceback (most recent call last):
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\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 "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.wintypes.LP_c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/Satyam Kumar Pandey/Desktop/assistant/a.py", line 7, in <module>
engine = pyttsx3.init()
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 24, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 670, in <module>
ISpeechBaseStream._methods_ = [
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 329, in __setattr__
self._make_methods(value)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\Satyam Kumar Pandey\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 125, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
Try using a lower version of pyttsx3. Do the following:
pip uninstall pyttsx3
pip install pyttsx3==2.6