Basically after creating the executable, pygame suddenly can't open the .png
images.
I am using Python 3.5 and cx_Freeze version 5.1.1.
The images are in the same directory than the game file. The game runs just fine before making it an executable. Any help would be appreciated.
Here is my setup.py
:
from cx_Freeze import setup, Executable
setup(name="Mygame",
version="1.0",
description="my game",
options={"build.exe":{"packages":["pygame"],
"included_files":["vivi.png","anastasia.png","Bird.png"]}},
executables=[Executable("george_abc.py")])
Here is the error that I got:
Traceback (most recent call last):
File "C:\Users\Μάνος\AppData\Local\Programs\Python\Python35\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Users\Μάνος\AppData\Local\Programs\Python\Python35\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "george_abc.py", line 164, in <module>
pygame.error: Couldn't open vivi.png
It looks like there are typos in the options
dictionary: build.exe
should be replaced by build_exe
and included_files
by include_files
, see the cx_Freeze
documentation.
options={"build_exe":{"packages":["pygame"],
"include_files":["vivi.png","anastasia.png","Bird.png"]}},
Once you have made the executable, you should be able to see the image files vivi.png
, ... in the build directory.