I'm making Pong Game with Python and wanna put an audio file in it.
but the file doesn't play with this error message
Error: AudioFileOpen failed ('wht?')
here is my part of code. (I imported os module on top.)
if ball.ycor() > 290:
ball.sety(290)
ball.dy *= -1
os.system('afplay bounce.wav')
The audio file (bounce.wav) is in same directory with Pong game python file. I don't know what the problem is.
please help me, thank you.
You need to pass the absolute path to the afplay. Try using this: