import pygame
file = 'some.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play()
This outputs, "Process finished with exit code 0", but it doesn't play anything. How can I resolve this problem?
import pygame
file = 'some.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play()
This outputs, "Process finished with exit code 0", but it doesn't play anything. How can I resolve this problem?
The play function starts the music playing, but returns immediately. Then your program reaches it's end, and the pygame object is automatically destroyed which causes the music to stop.
As you commented, it does play the music if you wait for it before exiting - because then the pygame object isn't destroyed until the while loop finishes.