3

First the setup: Windows 8.1 64bit, Python 3.4 32bit.

I wanted to run the code here. So I installed comtypes

pip install comtypes

I then tried to run the code, i got

ImportError: cannot import name 'SpeechLib'

Then tried this code here to try and generate the needed SpeechLib module.

I am however still getting the same error, what should I try next?

Community
  • 1
  • 1
zamarov
  • 165
  • 2
  • 16

1 Answers1

3

Running these lines made it work:

from comtypes.client import CreateObject
engine = CreateObject("SAPI.SpVoice")
stream = CreateObject("SAPI.SpFileStream")

Output was:

# Generating comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4
# Generating comtypes.gen.SpeechLib

After this I got no import error anymore, as expected.

zamarov
  • 165
  • 2
  • 16