[Tutor] Pygame mixer music

Mikael Lenander mikael.lenander1 at gmail.com
Sat Feb 22 12:33:36 EST 2020


I created a music player with tkinter and pygame 1.9.6 mixer. Yesterday it
worked flawlessly with mp3 files. Today, when I tried to play an mp3 file,
the music player doesn't work anymore, though I haven't changed the code
since yesterday. To check if there's something wrong with my code, I
created this simple program.

from tkinter import *
from pygame import mixer

root = Tk()
mixer.init()
mixer.music.load("journey.wav")
mixer.music.play()

root.mainloop()

This program plays the music as it should. However, when I run the program
using an mp3 file instead of wav, I get this error message.

Traceback (most recent call last):
  File "C:/Users/Mikael/PycharmProjects/peli3/music.py", line 6, in <module>
    mixer.music.load("miugemusaa.mp3")
pygame.error

I tried this with several mp3 files. All the music files are in the Pycharm
project folder.


More information about the Tutor mailing list