0

I can't seem to get images to work when using cx_Freeze. I tried looking at another answer, found here, but got the error: cannot find file/directory named Documents\images\robot_standing.fw.png

Here is my setup.py file:

from cx_Freeze import setup,Executable

includefiles = ['Documents\images\robotStanding_sprite.fw.png', 'Documents\images\dirt_block.fw.png','Documents\images\grass_block.fw.png','Documents\images\spikes.fw.png','Documents\images\title_image.fw.png']
includes = []
excludes = []
packages = []

setup(
    name = 'Robot Game',
    version = '0.1',
    description = 'null',
    options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}},
    executables = [Executable('Robot Game.py')]
)

What am I doing wrong?

Community
  • 1
  • 1
Alexdr5398
  • 51
  • 1
  • 6

2 Answers2

1

I just had the same problem. I solved it in two steps:

1) I used a setup.py script based on the answer of Brian in How do I use cx_freeze? and ran it as described by aquavitae in the same post.

2) I copied all of the image files manually into the build\exe.win32-3.3 directory where the executable and other auxiliary files resides.

Note: I used capital letters in the name of my source code file because I wanted the executable to have a name with capitals. It worked fine.

Community
  • 1
  • 1
Glenn Ledder
  • 21
  • 1
  • 4
-1

You can't use images with . in names of files because computer doesn't know what is extension. You should name'Documents\images\robotStanding_sprite.fw.png' 'Documents\images\robotStanding_sprite_fw.png'

knowledge
  • 383
  • 3
  • 15