I was making a Tetris-like game, and I would like my friends to try it so I'm going to export it as an .exe file, but I'm playing the track in the background this way:
winsound.PlaySound('C:/Users/User/folder/project/tetris/tetrismusic.wav',
winsound.SND_LOOP + winsound.SND_ASYNC)
I don't know if there is a way to play the file another way that doesn't involve the path. I've also tried:
winsound.Playsound('tetrismusic.wav', winsound.SND_LOOP + winsound.SND_ASYNC))
But it gives out an error saying the file can't be played.
Try putting a
./before the filename.winsound.Playsound('./tetrismusic.wav', winsound.SND_LOOP + winsound.SND_ASYNC))Or — alternatively — add the
SND_FILENAMEflag.winsound.Playsound('tetrismusic.wav', winsound.SND_LOOP + winsound.SND_ASYNC + winsound.SND_FILENAME))Checking the docs, it seems the
Playsoundfunction is assuming thattetrismusic.wavis a sound alias.