Nov-30-2020, 03:16 PM
I'm trying to make a christmas card in python. If a run the program with python it runs fine.
but after:
On linux everything works when compiling the program. Only change there is I don't use winsound.
Partial python code:
but after:
pyinstaller cc.py -w -y --clean --onefile --add-data "music;music"The exe is created succesfully, but there is no sound at all. I can see it takes time to extract the music. Though, the program continues without music.
On linux everything works when compiling the program. Only change there is I don't use winsound.
Partial python code:
# resource_path is the relative path to the resource file
def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
# Play background music
bgm = resource_path("music\letitsnow.wav")
volume = 1.0
winsound.PlaySound(bgm, winsound.SND_FILENAME|winsound.SND_ASYNC)
time.sleep(1)Any suggestions? I just started learning python. And the windows thing is not really my thing but I need to compile the christmas card for windows also.

. And I missed something this simple.