Skip to content

Fixes Traceback when setting Sapi.SpVoice.Voice property#1211

Closed
kdschlosser wants to merge 1 commit intomhammond:masterfrom
kdschlosser:TTS.Voice
Closed

Fixes Traceback when setting Sapi.SpVoice.Voice property#1211
kdschlosser wants to merge 1 commit intomhammond:masterfrom
kdschlosser:TTS.Voice

Conversation

@kdschlosser
Copy link
Copy Markdown

This problem can be reproduced very easily. The code and Traceback are as follows.

Code:

import win32com.client
import pythoncom

pythoncom.CoInitialize()
tts = win32com.client.Dispatch("Sapi.SpVoice")
tts.Voice = tts.GetVoices('Name=Microsoft Anna')[0]

Traceback:

Traceback (most recent call last):
  File "", line 6, in <module>
    tts.Voice = tts.GetVoices('Name=Microsoft Anna')[0]
  File "\win32com\client\dynamic.py", line 565, in __setattr__
    self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)

I have not come across anything that this fix causes an issue with. Because of the broad scope of com I am not able to test everything. This may give some insight on where the problem may lie, Or it could be the solution.

Thanks.
Kevin

A traceback occurs when setting the Voice property in  Sapi.SpVoice

code to reproduce the problem.

    import win32com.client
    import pythoncom
    
    pythoncom.CoInitialize()
    tts = win32com.client.Dispatch("Sapi.SpVoice")
    tts.Voice = tts.GetVoices('Name=Microsoft Anna')[0]

The traceback

    Traceback (most recent call last):
      File "", line 6, in <module>
        tts.Voice = tts.GetVoices('Name=Microsoft Anna')[0]
      File "\win32com\client\dynamic.py", line 565, in __setattr__
        self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
    pywintypes.com_error: (-2147352573, 'Member not found.', None, None)

I have not come across anything that this fix causes an issue with. Because of the broad scope of com I am not able to test everything. This may give some insight on where the problem may lie.
@kdschlosser
Copy link
Copy Markdown
Author

I apologize for the duplicate PR. i did not realize that someone had submitted a PR for this issue. I had checked Sourceforge some time ago and saw this issue had been reported several years ago. and upon downloading the latest version and saw the problem still existed. I decided to make a PR.

@mhammond mhammond closed this in 1350d43 Sep 28, 2018
@kdschlosser kdschlosser deleted the TTS.Voice branch September 28, 2018 08:17
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

Successfully merging this pull request may close these issues.

1 participant