0

I have no idea when I executed my code and it said "pygame.error". When I click "Run "menu"" in pycharm, it would give me "pygame.error". If I click "Debug "menu"", my program will smoothly operate and load the music properly. I don't know how that happened. Hope to find some helps here.
https://i.stack.imgur.com/xx81D.png -> the left is "Run" button, right one is "Debug" button. Here is the error feedback:

Traceback (most recent call last):
  File "D:/pywork/menu.py", line 65, in <module>
    G.run()
  File "D:/pywork/menu.py", line 43, in run
    pygame.mixer.music.load("bgm//disillusion.mp3")
pygame.error

And here is my code:

if keys[pygame.K_RETURN]:
     pygame.mixer.init()
     pygame.mixer.music.load("bgm//disillusion.mp3")
     pygame.mixer.music.play(-1, 0.0)

Thanks in advance.

Pom Li
  • 1
  • Try running the script from terminal. If it runs fine, I suppose the problem is with the IDE for which I would suggest you to reinstall it. – Janam Zaveri Sep 23 '21 at 06:54
  • I just had a try, and showed that it works from terminal. I need to reinstall pygame I suppose? or reinstall pycharm? – Pom Li Sep 23 '21 at 08:49

0 Answers0