2

When I use the code:

speak = win32com.client.Dispatch('Sapi.SpVoice')
speak.Volume = 100
speak.Rate = 6
speak.Voice = speak.GetVoices('Name=Microsoft Mary').Item(0)

It gives me the error:

speak.Voice = speak.GetVoices('Name=Microsoft Mary').Item(0)
File "C:\Python25\lib\site-packages\win32com\gen_py\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py", line 1872, in Item
ret = self._oleobj_.InvokeTypes(0, LCID, 1, (9, 0), ((3, 1),),Index
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147200967), None)

Can someone please help? Thank you!

1 Answer 1

4

My Windows 10 system has no "Microsoft Mary" - only David and Zira.

You can inspect what's available with:

>>> speak.GetVoices().Item(0).GetDescription()
u'Microsoft David Desktop - English (United States)'
>>> speak.GetVoices().Item(1).GetDescription()
u'Microsoft Zira Desktop - English (United States)'
>>> speak.GetVoices().Item(2).GetDescription()

If I use one of those it works:

>>> speak.GetVoices("Name=Microsoft Zira")
<COMObject <unknown>>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! I did not know that Windows 10 only had Davis and Zira.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.