I copied this program from a previous reply on this site:

import pygame

while pygame.mixer.music.get_busy()==True:

The 'beep.wav. file is located in the python programs file

When I run it, I get the following:

Traceback (most recent call last):
  File "/home/pi/programs/test pygame.py", line 3, in <module>
pygame.error: Couldn't open 'beep.wav'

I would be grateful for advice about where I am going wrong. have I put the wav file in the wrong place?


  • check the bit rate of the file. I seem to remember that pygame has a specific file format of what it will play back. I used it a couple years back and had to use Audacity to convert a bunch of little sound bites to the correct format for it to work. – Chef Flambe Feb 2 '18 at 21:35

Solved. It is a problem with the 'wav' file. I tried with a 'wav' file from the python games folder, and that works.

I don't know what the problem with my file is - it works ok with windows, but that's a different issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.