1

I am trying to play .mp3 files using pygame. But pygame.mixer.music.load("A.mp3") is causing my interpreter to crash. My .py file and .mp3 files are in the same folder. I have also tried specifying the full path for the mp3 file. Someone please help. I am using anaconda. Here is my code for reference.

import pygame, sys, time
from pygame.locals import *

pygame.init()

DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Memes.')


pygame.mixer.music.load("A.mp3")
pygame.mixer.music.play()
time.sleep(2)
pygame.mixer.music.stop()

while True: # Main Loop

    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    pygame.display.update()

Crash screenshot

0 Answers0