1
Python / Re: cx_freeze pySFML compilation AttributeError, no attribute Rectangle
« on: November 05, 2013, 10:10:54 pm »Ok, I've come up with a solution for python 3.3. The trick is copying sfml over manually and not letting cxfreeze do it.
My test.pyimport sfmlMy setup.py
import sys
from cx_Freeze import setup, Executable
if sys.platform == "win32":
base = "Win32GUI"
buildOptions = {"includes":["numbers","re"],
"excludes":["sfml"]
}
setup(
name = "Test",
version = "1.0",
description = "pysfml test",
options = dict(build_exe = buildOptions),
executables = [Executable("test.py", base=base)])
I then build with cxfreeze and then copy the sfml forder from "C:\Python33\Lib\site-packages" to the build directory.
Oh, great, your solution work fine with me also.
@Anvilfolk : Your problem is weird, and probably it's an issue from cx_freeze for python3.3 ? Because my project under python3.2 still work properly after been packaged by cx_freeze without particular setting like "include_files", and I import a lot of custom module (like "engine.main", "engine.physics.body", ...).
Moreover, in my test with pymunk (chipmunk) I include files called "functions.py", "main.py" and "classes.py". I haven't the problem with the setup.py here :
from cx_Freeze import setup, Executable
import sys
# Les dependances sont automatiquement definies, mais certaines sont
# parfois omises, on peut les ajouter manuellement ici :
includes = ["numbers", "re"]
excludes = ["sfml"]
packages = []
path = sys.path
# On defini qu'il s'agit d'un programme graphique si on est sous windows. (pour plus tard)
base = "Console"
#if sys.platform == "win32":
# base = "Win32GUI"
#On appelle la fonction setup pour creer notre executable.
setup(name = "PySFML & Pymunk Test",
version = "1.0.0",
description = "Un test de PySFML et Pymunk.",
options = {"build_exe": {"includes": includes,
"excludes": excludes,
"packages": packages,
"path": path,
"optimize": 2}
},
executables = [Executable("pysfml_pymunk_test.py", base=base)])
print("=============================")
print("Il faut copier manuellement le repertoire C:\Python33\Lib\site-packages\sfml\ dans le dossier exe.win32-3.3.")
import sys
# Les dependances sont automatiquement definies, mais certaines sont
# parfois omises, on peut les ajouter manuellement ici :
includes = ["numbers", "re"]
excludes = ["sfml"]
packages = []
path = sys.path
# On defini qu'il s'agit d'un programme graphique si on est sous windows. (pour plus tard)
base = "Console"
#if sys.platform == "win32":
# base = "Win32GUI"
#On appelle la fonction setup pour creer notre executable.
setup(name = "PySFML & Pymunk Test",
version = "1.0.0",
description = "Un test de PySFML et Pymunk.",
options = {"build_exe": {"includes": includes,
"excludes": excludes,
"packages": packages,
"path": path,
"optimize": 2}
},
executables = [Executable("pysfml_pymunk_test.py", base=base)])
print("=============================")
print("Il faut copier manuellement le repertoire C:\Python33\Lib\site-packages\sfml\ dans le dossier exe.win32-3.3.")