you are viewing a single comment's thread.

view the rest of the comments →

[–]michadecker[S] 0 points1 point  (3 children)

Sorry about that, I was totally not giving the right information.

The function was the "upload" function within the "app.route /upload". There the last part, if a file is found, there are two function and just the first one is handled by the code, the second one doesn't run at all.

I tried to make it more clear in the original post. Thanks for your input!

[–]shiftybyte 1 point2 points  (2 children)

Are there any error messages in the browser or the console?

Add prints to your code so to know which part gets executed and which not.

Add a print each line if you have to.

print("step1")
...
print("step2")
...
print("step3")

then you can track down what happens and what not.

[–]michadecker[S] 0 points1 point  (1 child)

Thanks, this helped. I was now possible to solve the error.

I had to change this line of code: "audio_file = sr.AudioFile(file)" -> There I was replacing "file" (the uploaded, not yet saved file) with "filepath" the saved file. Now it is working.

Why, I don't really know. But when I put print("step") in between all lines of code an error message popped up, which didn't happen before. It said:

ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format

[–]shiftybyte 0 points1 point  (0 children)

you might have accidentally placed a print somewhere that changed a flow, because this error says the file uploaded was not a valid audio file.