Nov-24-2019, 02:22 PM
(This post was last modified: Nov-24-2019, 02:23 PM by mad_accountant.)
Hi
I am trying to convert my python project into an executable using cx_Freeze. Script of setup.py is as follows:
The problem is that cx_Freeze is not creating the 'images' and 'sounds' folders. Instead, it is creating all the files within the same directory as the exe file.
I manually created the images folder and sounds folder in the same directory as the exe file and copied the relevant files and the exe file executed flawlessly.
How can I get cx_Freeze to create these folders automatically?
I am trying to convert my python project into an executable using cx_Freeze. Script of setup.py is as follows:
import cx_Freeze files_list = ['alien.py', 'bullet.py', 'button.py', 'game_stats.py', 'high_score.txt', 'scoreboard.py', 'settings.py', 'ship.py', 'sounds.py', 'images/alien.bmp', 'images/ship.bmp', 'sounds/background_music2.wav', 'sounds/explosion4.wav', 'sounds/game_over2.wav', 'sounds/laser1.wav', 'sounds/level_complete2.wav'] executables = [cx_Freeze.Executable("alien_invasion.py")] cx_Freeze.setup( name="Alien Invasion", options={"build_exe": {"packages":["pygame"], "include_files":files_list}}, executables = executables )When I execute it, cx_Freeze runs without error. However, when I run the exe file, I get the traceback "couldn't open images/ship.bmp."
The problem is that cx_Freeze is not creating the 'images' and 'sounds' folders. Instead, it is creating all the files within the same directory as the exe file.
I manually created the images folder and sounds folder in the same directory as the exe file and copied the relevant files and the exe file executed flawlessly.
How can I get cx_Freeze to create these folders automatically?