MY PYTHON VERSION IS 3.10
MY PYGAME VERSION IS 2.1.3
I have the following problem:
FileNotFoundError: No file '../Assets/Music/ability.mp3' found in working directory 'C:\Users\acmem\Desktop\programacion'.
The code of the mixer file is the following:
import pygame; from pygame import mixer; pygame.init(); import colorama; from colorama import Fore; colorama.init()
def new_ability():
path = "../Assets/Music/ability.mp3"
pygame.mixer.init()
pygame.mixer.Sound(path).play()
The folder structure is the following:
JuegoTXT: Modules\abilities.py (the mixer file)
Assets\Music\ability.mp3 (The file I want to play)
Any help is appreciated, thank you.
Relative path depends on your working folder and could be different when you execute the script, try changing the code, so it is bound to the actual python file
...
import pathlib
root = pathlib.Path(__file__).parent
path = root / "../Assets/Music/ability.mp3"