Python Forum
How to get cx_Freeze to make folders
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with cx_freeze app only on one pc floatingshed 0 1,768 Mar-19-2021, 05:19 PM
Last Post: floatingshed
Exclamation Help with cx_Freeze mederic39 3 2,833 Jan-31-2021, 12:05 PM
Last Post: snippsat
  sub-folders in folders from text line jenost 1 1,532 Mar-31-2020, 07:16 AM
Last Post: ndc85430
  cx_freeze frozen executive introduces WinError 10049 KipCarter 3 3,088 Jan-14-2020, 02:34 PM
Last Post: KipCarter
  Python 3.6 Alternatives to Cx_Freeze KipCarter 5 4,955 Jan-14-2020, 11:51 AM
Last Post: KipCarter
  cx_freeze exe does not work? Skycoder 4 6,259 Jan-13-2020, 06:50 PM
Last Post: KipCarter
  cx_freeze setup.py error: No module __SNMP-FRAMEWORK-MIB nacho 8 8,853 Jul-26-2019, 09:33 PM
Last Post: njmatt415
  Error in build using cx_freeze with psychopy based animation olivyac 0 2,868 Sep-19-2017, 07:55 PM
Last Post: olivyac

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020