I have a simple kivy file in which i want to cover the entire canvas with an image bgi.jpg
MainWidget:
<MainWidget>:
canvas.before:
Rectangle:
size:self.size
source:'bgi.jpg'
and the .py file code is
from kivy.app import App
from kivy.uix.widget import Widget
class MainWidget(Widget):pass
class TestApp(App):pass
TestApp().run()
I tried to build this code into .exe file using auot-py-to-exe. i added both kivy file and the image file as a additional file and tried to build into exe but the executable file is crashing with the error as shown below
Traceback (most recent call last):
File "kivy\lang\builder.py", line 925, in _build_canvas
File "kivy\graphics\instructions.pyx", line 380, in kivy.graphics.instructions.VertexInstruction.source.__set__
File "kivy\graphics\context_instructions.pyx", line 431, in kivy.graphics.context_instructions.BindTexture.source.__set__
File "kivy\core\image\__init__.py", line 561, in __init__
File "kivy\core\image\__init__.py", line 754, in _set_filename
File "kivy\core\image\__init__.py", line 460, in load
File "kivy\core\image\__init__.py", line 223, in __init__
File "kivy\core\image\img_sdl2.py", line 47, in load
Exception: SDL2: Unable to load image
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Main.py", line 9, in <module>
File "kivy\app.py", line 954, in run
File "kivy\app.py", line 923, in _run_prepare
File "kivy\app.py", line 696, in load_kv
File "kivy\lang\builder.py", line 305, in load_file
File "kivy\lang\builder.py", line 405, in load_string
File "kivy\uix\widget.py", line 470, in apply_class_lang_rules
File "kivy\lang\builder.py", line 540, in apply
File "kivy\lang\builder.py", line 595, in _apply_rule
File "kivy\lang\builder.py", line 928, in _build_canvas
kivy.lang.builder.BuilderException: Parser: File "C:\Users\User\Documents\Python scripts\Python class\Kivy projects\exe test\Main with image\test.kv", line 6:
...
4: Rectangle:
5: size:self.size
>> 6: source:'bgi.jpg'
7: Label:
8: id:lbl
...
Exception: SDL2: Unable to load image
File "kivy\lang\builder.py", line 925, in _build_canvas
File "kivy\graphics\instructions.pyx", line 380, in kivy.graphics.instructions.VertexInstruction.source.__set__
File "kivy\graphics\context_instructions.pyx", line 431, in kivy.graphics.context_instructions.BindTexture.source.__set__
File "kivy\core\image\__init__.py", line 561, in __init__
File "kivy\core\image\__init__.py", line 754, in _set_filename
File "kivy\core\image\__init__.py", line 460, in load
File "kivy\core\image\__init__.py", line 223, in __init__
File "kivy\core\image\img_sdl2.py", line 47, in load
I am fairly new to both kivy,python and pyinstaller, so i have no idea what is wrong or should image files be added in a different method