Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to get cx_Freeze to make folders
#1
Hi

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?
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Folders in folders jenost 5 236 Apr-26-2020, 05:35 PM
Last Post: jenost
  sub-folders in folders from text line jenost 1 147 Mar-31-2020, 07:16 AM
Last Post: ndc85430
  cx_freeze frozen executive introduces WinError 10049 KipCarter 3 382 Jan-14-2020, 02:34 PM
Last Post: KipCarter
  Python 3.6 Alternatives to Cx_Freeze KipCarter 5 570 Jan-14-2020, 11:51 AM
Last Post: KipCarter
  cx_freeze exe does not work? Skycoder 4 2,247 Jan-13-2020, 06:50 PM
Last Post: KipCarter
  cx_freeze setup.py error: No module __SNMP-FRAMEWORK-MIB nacho 8 3,795 Jul-26-2019, 09:33 PM
Last Post: njmatt415
  Error in build using cx_freeze with psychopy based animation olivyac 0 1,223 Sep-19-2017, 07:55 PM
Last Post: olivyac

Forum Jump:


Users browsing this thread: 1 Guest(s)