I copy code from a tutorial and run as below, but I have an error from
subprocess.call(['mpg321', "welcome.mp3", '--play-and-exit'])
import subprocess
from gtts import gTTS
mytext = 'Welcome to Innovate Yourself!'
language = 'en'
myobj = gTTS(text=mytext, lang=language)
myobj.save("welcome.mp3")
subprocess.call(['mpg321', "welcome.mp3", '--play-and-exit'])
the error like this
File "text_to_speech.py", line 12
subprocess.call(["vlc","C:\Users\Alexp\rasatest\actions\welcome.mp3","--play-and-exit"])
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
(rasatest) C:\Users\Alexp\rasatest\actions>python text_to_speech.py
File "text_to_speech.py", line 13
subprocess.call(["vlc","C:\Users\Alexp\rasatest\actions\welcome.mp3","--play-and-exit"])
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
how can I solve this error?