This question concerns an app built with Kivy: http://kivy.org/ but I think it
could be answered with general knowledge of the way Cython and cx_Freeze
interact.
After some effort I've assembled a virtualenv that contains all the modules my
Kivy app needs, and uses a locally built Python 3.4.3 executable. I then wrote
a tiny test script that just imports a foundational Kivy class:
import kivy.event
if __name__ == '__main__':
kivy.event.ObjectWithUid()
And made a setup.py:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
build_exe_options = {
"packages": [
"kivy"
]
}
setup(
name="cxtest",
executables=[Executable("run.py", base=base)],
options={"build_exe": build_exe_options}
)
Run as python3 setup.py build (w. my virtualenv activated), this creates the
expected output files under build/exe.linux-x86_64-3.4 -- including all of the
Cython-generated .so files, like kivy._event.so, which contains ObjectWithUid.
Yet, when I try actually running the resulting executable (with or without the
virtualenv), it seems not to understand what I've done:
...
File
"/home/sanotehu/src/Python-3.4.3/lib/python3.4/importlib/_bootstrap.py",
line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "ExtensionLoader_kivy_properties.py", line 22, in <module>
File "ExtensionLoader_kivy_properties.py", line 14, in __bootstrap__
File "kivy/_event.pxd", line 3, in init kivy.properties
(kivy/properties.c:30308)
AttributeError: 'module' object has no attribute 'ObjectWithUid'
To begin with, it's using paths that aren't in the build directory, nor in my
PATH or PYTHONPATH. Perhaps that's normal?
But more worryingly, it seems like kivy.properties.so can't see inside of
kivy._event.so. I tried moving the libs around and renaming them and nothing
really seemed to make a difference.
I'm not all that familiar with Cython. It's possible there's something I need
to do to make its modules keep working when they've been moved and
renamed by cx_Freeze. Or maybe I need to tell cx_Freeze to move those
particular modules in a different way.
Please help me find a way to proceed.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
cx-freeze-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users