I'm trying to convert a very simple code to exe. Code utilizes Kivy as follows;
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.lang import Builder
#from kivy import Config
#Config.set('graphics', 'multisamples', '0')
class MyLayout(Widget):
def press(self, var_ex):
name = self.ids.name_input.text
self.ids.name_label.text = f"Hello {name} !" * var_ex
class MyApp(App):
def build(self):
return MyLayout()
if __name__.endswith('__main__'):from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.lang import Builder
Builder.load_string("""
<MyLayout>
BoxLayout:
orientation: "vertical"
size: root.width, root.height
spacing: 20
padding: 50
Button:
text: "English"
Button:
text: "Italian"
size_hint: ( None, None)
width: 100
height: 50
pos_hint: { "center_x": 0.5}
Button:
text: "German"
size_hint: ( 0.5, 0.5)
""")
class MyLayout(Widget):
pass
class MyApp(App):
def build(self):
return MyLayout()
if __name__ == '__main__':
MyApp().run()
This code works very well in python, with no errors. But when I try to convert it to exe via this setup.py file and cx_freeze;
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["kivy","pygame","kivy_deps.gstreamer"], "includes": ["kivy_deps.glew","kivy_deps.sdl2","wheel","setuptools","pygments","docutils","win32api","PIL"], "excludes": []}
#base = ""
base = "Win32GUI"
setup(
name="guifoo",
version="0.1",
description="My GUI application!",
options={"build_exe": build_exe_options},
executables=[Executable("test.py", base=base)],
)
I get following error when running the created exe file (exe file is created without error);
Traceback (most recent call last):
File "D:\Python310\kivy_venv\Lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 113, in run
module_init.run(name + "__main__")
File "D:\Python310\kivy_venv\Lib\site-packages\cx_Freeze\initscripts\Console.py", line 15, in run
exec(code, module_main.__dict__)
File "test.py", line 1, in <module>
File "D:\Python310\kivy_venv\lib\site-packages\kivy\__init__.py", line 317, in <module>
mod = importer.find_module(modname).load_module(modname)
File "D:\Python310\kivy_venv\lib\site-packages\kivy_deps\glew\__init__.py", line 23, in <module>
p = join(d, 'share', 'glew', 'bin')
File "D:\Python310\lib\ntpath.py", line 78, in join
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Can somebody help me on this ? Thanks in advance...
P.S. I can give more information if requested.