Syntax error python 2.7

93 views Asked by At

Im have syntax error in def reverse app.route i know there is something wrong with getAudio but i dont know what. Here is example from pydub documentation

    sound1 = AudioSegment.from_file("/path/to/sound.wav", 

format="wav")

And heres part of my code, commented

    @app.route('/Path/<filename>')  
def getFilePath(filename):
    return os.path.join(os.path.dirname(__file__), 'files', filename)

@app.route('/Audio/<filename>')
def getAudio(filename):
    return AudioSegment.from_file(getFilePath(filename, format="wav")


@app.route('/rev/<filename>')
def reverse(filename):
    song = getAudio(filename)
    song = song.reverse()   
1

There are 1 answers

1
Kevin On BEST ANSWER
return AudioSegment.from_file(getFilePath(filename, format="wav")

Looks like you're missing a parenthesis.

return AudioSegment.from_file(getFilePath(filename), format="wav")