Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)
I have attempted PyTTS (expostulated) and PyTTSx (the most suggested) and the two Google solutions (gTTS and another by some person named Hung Truong) yet none of them worked under Python 3.4. It appears they haven't been ported to 3.x.

I looked also on StackOverflow and Google, yet all the proposed TTS solutions don't work under Python 3. I'm on Windows 7.

1 Answer

0 votes
by (26.4k points)

I think you have imported the wrong module. You've used:

import gtts

blabla = ("Spoken text")

tts = gTTS(text=blabla, lang='en')

tts.save("C:/test.mp3")

Which resulting in the below error:

NameError: name 'gTTS' is not defined

Try the following code:

from gtts import gTTS

blabla = ("Spoken text")

tts = gTTS(text=blabla, lang='en')

tts.save("C:/test.mp3")

Are you looking for a good python tutorial? Join the python course fast and gain more knowledge in python.

Watch this video tutorial on how to become a professional in python

Browse Categories

...