IOError: [Errno 2] No such file or directory

python

#1

Hello, I’d like to play a sound from my workspace, I believe this is the correct path:

‘/home/ubuntu/workspace/audio/test.wav’

So I’m using pydub to play this:

song = AudioSegment.from_wav("/home/ubuntu/workspace/audio/test.wav")
play(song)

The result is this error:

IOError: [Errno 2] No such file or directory: ‘home/ubuntu/workspace/audio/test.wav’

I saw a similar topic where a guy was reading a CSV but having the home path doesn’t make any difference. Am I structuring this path correctly?


#2

Your pathing should be right, but looking through StackOverflow seems to suggest that the issue may be with pydub: https://stackoverflow.com/questions/34196195/pydub-from-mp3-gives-errno-2-no-such-file-or-directory . If you’re receiving a stack trace, you may want to check that to see if there’s a dependency that you may be missing.

Hope this helps!

Bryce


#3

As far as I can see the way I’m implementing audio using python is a problem with a web app, I’ve reproduced this issue with a number of libraries on 3 different platforms. It has been suggested that I use HTML5 and jQuery to perform the same operations.