-1
all right? Well I come here to ask for a solution regarding playing mp3 music in Python. I imported the Pygame library and used the mixer module to play python music:
import pygame
pygame.init()
pygame.mixer.music.load('brain_damage.mp3')
pygame.mixer.music.play(loops=0, start=0.0)
pygame.event.wait()
After I write this script and run my program, it gives an error output, saying:
Traceback (most recent call last):
File "/home/gabriel/Documentos/GitHub/Projetos Pessoais/olamundo.py/_exercicios/teste.py", line 3, in <module>
pygame.mixer.music.load('music/brain_damage.mp3')
pygame.error: Couldn't open 'music/brain_damage.mp3'
For comparison purposes, I created another Python file and used the same code as the image above, and to my surprise, the mixer managed to run my mp3 file. You know why you proceed?
you checked if the song is in the same folder as the code?
– Codigo de Senior
yes, it’s in the same code folder
– Gabriel Viticov
mp3 file is not in "music" folder, in this folder are just few.wav files. The song I want to play in my program is in the folder called "_exercicios" along with the code
– Gabriel Viticov
What’s this OS you’re wearing?
– yoyo