I am running lighttpd webserver on my raspberry pi (raspbian os). On my small website I have a form which executes a python script via cgi - this part is working okay. Now I tried to call espeak from python:
os.system('espeak "hallo" ')
When I execute the script directly it works fine and says "hello" (ove hdmi / TV if that matters), but when I try to start the script over the website it is not working.
I guess it has something to do with permissions, other os.system() calls work fine. Using espeak is not necessary, any text-to-speech system will do. Thanks.
Edit for better understanding:
I have this html form
<form action="/cgi-bin/test.py">
<input type="submit" value="PythonTest" /><br>
</form>
and in the test.py:
#!/usr/bin/python
import cgi,os,cgitb,sys
cgitb.enable()
sys.path.insert(0, "/usr/bin/espeak")
def say(something):
os.system('sudo espeak "{0}"'.format(something))
print "Yeah, Python!"
res = os.system("ls -l")
res1 = say("hallo")
print "end"
the error log of lighttpd is empty and also cgitb is showing no error. The Sound is just not playing. The output is:
Yeah, Phyton!
<ls output>
None
end