Hi, Im new to programming and to Python. Im making a program to get weather information from online, parse it the way I want to, then have Festival read it aloud to me. I got the weather info and parsing done exactly how I want but am getting an error while having Festival read it back to me. I haven't had any problems with festival before and use similar code with no problem. I think it may have to do with the data type some how. Here is the code followed by the error message:
import subprocess
os.system('modprobe pcspkr')
logfile = open("weather.txt", "r").readlines()
here I got a specific line from file with my weather info
line = logfile[34]
print (line)
Here I parsed it and replaced words with other words to make a sentence for Festival to speak
line = line.replace("-", "will be")
line = line.replace("<br />", "")
line = line.replace(":", " temperature is,")
line = line.replace("Low", ", Low ")
And here is the problem area which will work if I replace the "line" variable with just about anything else
subprocess.call('echo '+line+' | festival --tts', shell=True)
print(line)
Here is the output when I run program
/bin/sh: 2: Syntax error: "|" unexpected
Wed will be Mostly Sunny. High temperature is, 54 , Low temperature is, 34
Any idea of whats going on here?