Pyttsx3 Voice KeyError: 'sapi5' - python-3.x

Getting unknown voice id error. I tried with ( Pyttsx3 2.6 and python 3.6 ), ( pyttsx3==2.9 & python 3.10)
Traceback (most recent call last):
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\__init__.py", line 44, in init
eng = _activeEngines[driverName]
File "E:\anaconda3\envs\dummy\lib\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 "C:/Users/Dnyanesh/PycharmProjects/dummy/main.py", line 5, in <module>
engine = pyttsx3.init()
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\__init__.py", line 46, in init
eng = Engine(driverName, debug)
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\engine.py", line 52, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\driver.py", line 77, in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\drivers\sapi5.py", line 22, in buildDriver
return SAPI5Driver(proxy)
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\drivers\sapi5.py", line 41, in __init__
self.setProperty('voice', self.getProperty('voice'))
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\drivers\sapi5.py", line 82, in setProperty
token = self._tokenFromId(value)
File "E:\anaconda3\envs\dummy\lib\site-packages\pyttsx3\drivers\sapi5.py", line 66, in _tokenFromId
raise ValueError('unknown voice id %s', id_)
ValueError: ('unknown voice id %s', 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices\\Tokens\\MSTTS_V110_enUS_DavidM')

Related

Attribute error: comtypes has no module named ISpeech

Traceback (most recent call last):
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\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 "h:\My Drive\Semester 6\Artificial Intelligence\JARVIS\jarvis.py", line 7, in <module>
engine = pt.init()
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\driver.py", line 52, in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\drivers\sapi5.py", line 30, in buildDriver
return SAPI5Driver(proxy)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\drivers\sapi5.py", line 35, in __init__
self._tts = comtypes.client.CreateObject('SAPI.SPVoice')
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\client\__init__.py", line 112, in GetBestInterface
interface = getattr(mod, itf_name)
AttributeError: module 'comtypes.gen.SpeechLib' has no attribute 'ISpeechVoice'
I have also tried re-installing Python and upgrading comtypes but everytime I get the same error. The program was working fine before I installed opencv-python. I have tried uninstalling it too but it doesn't make any difference.

what is the portable equivalent to linux`s signal.siginterrupt in python?

I have this Linux centric code that I would like to get to run on Windows, too:
class SignalObject:
MAX_TERMINATE_CALLED = 3
def __init__(self, shutdown_event):
self.terminate_called = 0
self.shutdown_event = shutdown_event
def default_signal_handler(signal_object, exception_class, signal_num, current_stack_frame):
signal_object.terminate_called += 1
signal_object.shutdown_event.set()
if signal_object.terminate_called >= signal_object.MAX_TERMINATE_CALLED:
raise exception_class()
def init_signal(signal_num, signal_object, exception_class, handler):
handler = functools.partial(handler, signal_object, exception_class)
signal.signal(signal_num, handler)
signal.siginterrupt(signal_num, False)
def init_signals(shutdown_event, int_handler, term_handler):
signal_object = SignalObject(shutdown_event)
init_signal(signal.SIGINT, signal_object, KeyboardInterrupt, int_handler)
init_signal(signal.SIGTERM, signal_object, TerminateInterrupt, term_handler)
return signal_object
Specifically, it bombs out on signal.siginterrupt(signal_num, False) and gives me this traceback:
ERROR:root: 0:00.000 MAIN Exception: module 'signal' has no attribute 'siginterrupt'
Traceback (most recent call last):
File "C:/Users/Documents/GitHub/magnetfeld-kabel/util/bin/magnetic_cable_interactive.py", line 186, in main
init_signals(main_ctx.shutdown_event, default_signal_handler, default_signal_handler)
File "C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\mptools-0.2.0-py3.7.egg\mptools\_mptools.py", line 115, in init_signals
init_signal(signal.SIGINT, signal_object, KeyboardInterrupt, int_handler)
File "C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\mptools-0.2.0-py3.7.egg\mptools\_mptools.py", line 110, in init_signal
signal.siginterrupt(signal_num, False)
AttributeError: module 'signal' has no attribute 'siginterrupt'
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/Documents/GitHub/magnetfeld-kabel/util/bin/magnetic_cable_interactive.py", line 221, in <module>
main(die_in_secs)
File "C:/Users/Documents/GitHub/magnetfeld-kabel/util/bin/magnetic_cable_interactive.py", line 186, in main
init_signals(main_ctx.shutdown_event, default_signal_handler, default_signal_handler)
File "C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\mptools-0.2.0-py3.7.egg\mptools\_mptools.py", line 115, in init_signals
init_signal(signal.SIGINT, signal_object, KeyboardInterrupt, int_handler)
File "C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\mptools-0.2.0-py3.7.egg\mptools\_mptools.py", line 110, in init_signal
signal.siginterrupt(signal_num, False)
AttributeError: module 'signal' has no attribute 'siginterrupt'
How can I change that to run on both Windows and Linux? I googled for equivalents and found nothing.

pypy Ensure pip error ("C:\pypy3.exe -m ensurepip") windows 10

I am trying to install pypy pip installation howveer there is this bug when I try to run pypy3 -m ensurepip I have a 64bit windows 10 os system. I get this error when I try to run the program in cmd:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\distutils\util.py", line 192, in subst_vars
return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\re.py", line 194, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\distutils\util.py", line 189, in _subst
return os.environ[var_name]
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\os.py", line 681, in __getitem__
raise KeyError(key) from None
KeyError: 'EXa8572'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\cli\base_command.py", line 188, in _main
status = self.run(options, args)
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\cli\req_command.py", line 185, in wrapper
return func(self, options, args)
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\commands\install.py", line 257, in run
isolated_mode=options.isolated_mode,
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\commands\install.py", line 599, in decide_user_install
if site_packages_writable(root=root_path, isolated=isolated_mode):
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\commands\install.py", line 544, in site_packages_writable
test_writable_dir(d) for d in set(get_lib_location_guesses(**kwargs))
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\commands\install.py", line 538, in get_lib_location_guesses
scheme = distutils_scheme('', *args, **kwargs)
File "C:\Users\maste\AppData\Local\Temp\tmpjdn5f_qd\pip-20.1.1-py2.py3-none-any.whl\pip\_internal\locations.py", line 125, in distutils_scheme
i.finalize_options()
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\distutils\command\install.py", line 321, in finalize_options
self.expand_basedirs()
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\distutils\command\install.py", line 495, in expand_basedirs
self._expand_attrs(['install_base', 'install_platbase', 'root'])
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\distutils\command\install.py", line 489, in _expand_attrs
val = subst_vars(val, self.config_vars)
File "C:\Users\maste\AppData\Local\Temp\Rar$EXa8572.21538\pypy3.7-v7.3.3-win32\lib-python\3\distutils\util.py", line 194, in subst_vars
raise ValueError("invalid variable '$%s'" % var)
ValueError: invalid variable '$'EXa8572''**strong text**

Python3 multiprocessing shared dictionary consume by all process

I'm beginner for multiprocessing,
i would like to use multiprocessing for parallel code running with streaming data.
To start good, I have coded below and got error.
Could you please tell me correct way to print on the screen.
Code:
import sys
from multiprocessing import Process, Manager
import time
def producer(dic, name):
for i in range(10000):
dic["A"] = i
time.sleep(2)
def consumer(dic, name):
for i in range(10000):
aval = dic.get("A")
#print(f" {name} - Val = {aval}")
sys.stdout.write(f" {name} - Val = {aval}")
sys.stdout.flush()
time.sleep(2.2)
if __name__ == '__main__':
manager = Manager()
dic = manager.dict()
Process(target=producer, args=(dic,"TT")).start()
time.sleep(1)
Process(target=consumer, args=(dic,"Con1")).start()
Process(target=consumer, args=(dic,"Con2")).start()
When I run the same in the windows console, I got below error, how can I print Consumer's print function in the console.Thanks
(base) PS D:\> python .\mulpro.py
Process Process-3:
Process Process-4:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 811, in
_callmethod
conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 297, in _
bootstrap
self.run()
File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 99, in ru
n
self._target(*self._args, **self._kwargs)
File "D:\mulpro.py", line 19, in consumer
aval = dic.get("A")
File "<string>", line 2, in get
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 815, in
_callmethod
self._connect()
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 802, in
_connect
conn = self._Client(self._token.address, authkey=self._authkey)
File "C:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 490, i
n Client
c = PipeClient(address)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 691, i
n PipeClient
_winapi.WaitNamedPipe(address, 1000)
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 811, in
_callmethod
conn = self._tls.connection
FileNotFoundError: [WinError 2] The system cannot find the file specified
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 297, in _
bootstrap
self.run()
File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 99, in ru
n
self._target(*self._args, **self._kwargs)
File "D:\mulpro.py", line 19, in consumer
aval = dic.get("A")
File "<string>", line 2, in get
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 815, in
_callmethod
self._connect()
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 802, in
_connect
conn = self._Client(self._token.address, authkey=self._authkey)
File "C:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 490, i
n Client
c = PipeClient(address)
File "C:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 691, i
n PipeClient
_winapi.WaitNamedPipe(address, 1000)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Process Process-2:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 297, in _
bootstrap
self.run()
File "C:\ProgramData\Anaconda3\lib\multiprocessing\process.py", line 99, in ru
n
self._target(*self._args, **self._kwargs)
File "D:\mulpro.py", line 13, in producer
dic["A"] = i
File "<string>", line 2, in __setitem__
File "C:\ProgramData\Anaconda3\lib\multiprocessing\managers.py", line 818, in
_callmethod
conn.send((self._id, methodname, args, kwds))
File "C:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 206, i
n send
self._send_bytes(_ForkingPickler.dumps(obj))
File "C:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 280, i
n _send_bytes
ov, err = _winapi.WriteFile(self._handle, buf, overlapped=True)
BrokenPipeError: [WinError 232] The pipe is being closed
The reason might be that the main process doesn't wait for two children process, so make your code like this could work:
def run():
manager = Manager()
dic = manager.dict()
Process(target=producer, args=(dic,"TT")).start()
time.sleep(1)
Process(target=consumer, args=(dic,"Con1")).start()
Process(target=consumer, args=(dic,"Con2")).start()
while True:
pass
if __name__ == '__main__':
run()
However it's very strange that if I append a dead loop in main instead of using another function, it still raise that exception. Anyway, the code above could help.

Scikit-Image gives me this error

File "/usr/local/lib/python3.5/dist-packages/skimage/io/_plugins/pil_plugin.py", line 53, in pil_to_ndarray
im.getdata()[0]
File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 1165, in getdata
self.load()
File "/usr/local/lib/python3.5/dist-packages/PIL/ImageFile.py", line 212, in load
s = read(self.decodermaxblock)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Custom vgg2.py", line 154, in <module>
img = io.imread(file_path)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/_io.py", line 61, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/manage_plugins.py", line 211, in call_plugin
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/_plugins/pil_plugin.py", line 37, in imread
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/_plugins/pil_plugin.py", line 61, in pil_to_ndarray
raise ValueError(error_message)
ValueError: Could not load ""
Reason: "[Errno 5] Input/output error"
Please see documentation at: http://pillow.readthedocs.org/en/latest/installation.html#external-libraries

Resources