Pygame failing to load mp3 file

46 views Asked by At

I am trying to load a mp3 file in pygame 2.1.2 (SDL 2.0.18, Python 3.9.13) but i am getting an error here is the code i am using:

self.jump_sound = pygame.mixer.Sound('C:/Users/IAMAUSER/OneDrive/Desktop/Pro/Pygame/audio/jump.mp3')

I am using "self." because i am doing this in a class and yes i have imported pygame

Error i am getting: Traceback (most recent call last): File "c:\Users\IAMAUSER\OneDrive\Desktop\Pro\Pygame\import pygame.py", line 139, in <module> player.add(Player()) File "c:\Users\IAMAUSER\OneDrive\Desktop\Pro\Pygame\import pygame.py", line 18, in __init__ self.jump_sound = pygame.mixer.Sound('C:/Users/IAMAUSER/OneDrive/Desktop/Pro/Pygame/audio/jump.mp3') pygame.error: Unable to open file 'C:/Users/IAMAUSER/OneDrive/Desktop/Pro/Pygame/audio/jump.mp3'

The player.add(Player()) is not the problem i think

I expected for it to load the sound so i could use self.jump_sound.play() to play the sound

0

There are 0 answers