I have a view which takes text from a form and uses python-espeak to turn the input into speech. This only works the first time the view is used, afterwards espeak does not produce anything. I think the issue is with espeak not resetting somehow, since I can still hear static afterwards as if espeak is still running, although that goes away and doesn't come back on the second form entry. Why does espeak fail to work the second time?
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
message = request.form['tts']
espeak.synth(message)
return redirect(url_for('index'))
return render_template('index.html')
<form method="post">
<input name="tts">
<input type="submit">
</form>