So here is what I am trying to do.
I have a small program, which makes use of the pygame music player to play an mp3. I have this mp3 in the same directory as my python based exe, so I can run it.
The problem is I have the path to the mp3 specified as a 'SOUND_FILE =' string as shown below:
pygame.init()
SOUND_FILE = r'C:\Users\Michael\Desktop\herprogram\classical.mp3'
pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.mixer.init()
pygame.mixer.music.load(SOUND_FILE)
pygame.mixer.music.play(0)
This means when I run an installation wizard on a different machine, the path to the mp3 will be wrong. It will have some other path/username.
The first part of the path I need to be dynamic, so I can concatenate it to the other half of the path I will specify in the installation wizard using an f string.
I have had a look at the python os module, but can't quite get my head around how to implement this.
Any help much appreciated.
Thanks, Michael