I've been unable to figure this issue with cx_Freeze out after a good amount of searching. These questions did not offer solutions that worked:
cx_Freeze Exe Application closes as soon as opens
How can I bundle other files when using cx_freeze?
The files are located in the same directory as rest of the game, everything works fine when I run the game from my code, the only issue is when I try to run it from the .exe file.
When I comment out the code of my game that loads in music/images, and build from that, the game works fine.
import cx_Freeze
import os
os.environ['TCL_LIBRARY'] = "C:\\Users\\Dan\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\Dan\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tk8.6"
includedfiles = ['Background.jpg', 'Background2.jpg', 'bgStream.jpg', 'IntroMus.mp3', 'StreamSong.mp3']
excludes = ['tkinter']
cx_Freeze.setup(
name="The Woodsman's Tale",
version='0.1',
description='TWT Game',
options={'build.exe': {'excludes': [excludes], "packages": ["pygame"],
'included_files': [includedfiles]}},
executables=[cx_Freeze.Executable("startmenu.py")])