Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Cx_Freeze pygame compiled file doesn't work

$
0
0
The following error happens if i try to compile my python (using python 3.2) file:

Traceback(most recent call last):
File
"c:\python32\lib\site-packages\cx_Freeze\initscripts\Console3.py", line
27, in <module>
  exec(code, m.__dict__)
 File "Abertura.py", line 208, in <module>
 File "Abertura.py", line 154, in main
 File "Abertura.py", line 9, in __init__
 pygame.error: Couldn't open
C:\Python32\build\exe.win32-3.2\library.zip\Imagens\menu1.png


I already included pygame._view and tried to copy the 'Imagens' directory to the library.zip file, but it doesn't work. I'm using images, musics and videos that come's from other directories by including in my code:

def file_path(filename, directory):
    return os.path.join(
                         os.path.dirname(os.path.abspath(
                                         __file__)),
                         directory,
                         filename
                        )

And this is my setup.py file:

from cx_Freeze import setup, Executable

exe=Executable(
     script="Abertura.py",
     base="Win32Gui",
     )
includefiles=[
              ('C:\Python32\Imagens','Imagens'), 
              ('C:\Python32\Musicas','Musicas'),
              ('C:\Python32\Videos','Videos')
              ]
includes=[]
excludes=[]
packages=[]
setup(
     version = "1.0",
     description = "RPG",
     author = "Pedro Forli e Ivan Veronezzi",
     name = "Batalha Inapropriada",
     options = {'build_exe':   {'excludes':excludes,'packages':packages,'include_
files':includefiles}},executables = [exe])

How do i fix it?
(sorry about my possibles english mistakes)

Viewing all articles
Browse latest Browse all 2703

Trending Articles