Urgent help plz ... pygame.mixer.init() error


last year I was doing program using pygame and tkinter , it’s mp3 player … and it was working with no issue, the GUI was showing and the music was playing fine.

this year when I run the same code it gives me pygame.mixer.init() error

when I put the curser in word mixer where the red underline is , it says “mixer” is not a known member of module “pygame”

and when I run the code in console it says pygame.mixer.init()# initialise the pygame
pygame.error: dsp: No such audio device

please help me on how to fix this error

There are two separate problems happening here that each need to be fixed.

The first problem is that it says “mixer” is not a known member of module “pygame”. This a warning from pyright, which is the code intelligence. Here, pyright is wrong so you have to disable this warning. Open up or expand the below post to see the solution:

The second problem is that a pygame.error says there is no audio device. You can look at the following topic for a solution. Note that audio in replit is usually unreliable, so it is not guaranteed to work for all users: