I am trying to run this pretty simple text-to-speech program on my Mac:
# Import the required module for text
# to speech conversion
from gtts import gTTS
# This module is imported so that we can
# play the converted audio
import os
# The text that you want to convert to audio
mytext = 'Welcome to geeksforgeeks!'
# Language in which you want to convert
language = 'en'
# Passing the text and language to the engine,
# here we have marked slow=False. Which tells
# the module that the converted audio should
# have a high speed
myobj = gTTS(text=mytext, lang=language, slow=False)
# Saving the converted audio in a mp3 file named
# welcome
myobj.save("welcome.mp3")
# Playing the converted file
os.system("mpg321 welcome.mp3")
but when I try to run it I am getting this error:
Traceback (most recent call last):
File "/Users/name/Documents/University/Intro to Python/Random/texttospeech.py", line 3, in <module>
from gtts import gTTS
File "/Users/name/Documents/University/Intro to Python/Random/gtts/__init__.py", line 3, in <module>
from .tts import gTTS, gTTSError
File "/Users/name/Documents/University/Intro to Python/Random/gtts/tts.py", line 6, in <module>
from six.moves import urllib
ModuleNotFoundError: No module named 'six'
The line 6 it seems to be referring to in tts.py is "from six.moves import urllib", if that matters. Running pip show six
looks fine, with version 1.15.0 installed in python3.7/site-packages and I'm using IDLE version 3.7 as well so it doesn't seem like the problem is there. I have tried uninstalling and reinstalling six, as well as pip install --ignore-installed six
and python -m pip install six
and while both run without issue, neither have fixed my problem. I don't know what else to try, can anyone help me out with this?