Python - Kivy - pyInstaller - Generate executables

Asked

Viewed 431 times

0

Good morning, everyone.

I’m on a kivy project where I’m working with, or at least trying to work on MVC mode. So I have view, model, controller folders. In view folder I have the ". Kv" kivy files.

The problem and my question is: How to use pyinstaller to generate an executable in this case? I have tried to use normally as when it is developed all in a single file but it does not work.

Grateful for the attention.

1 answer

0

Good morning, I went through the same problem, I found solution on the Kivy library website (kivy.org)

It turns out that currently, when we generate the executable through the pyinstaller, it does not load the file. Kv automatically (if this file is in the same folder as your main code).

One way around this is to inform Pyinstaller that you want to package this file . Kv too. For me it worked like this:

Place your file . Kv in a folder, which stays inside the folder where your main file is already (for ease)

If pyinstaller is installed, in CMD you can generate a file . spec with the following command: pyi-makespec nome_do_seu_arquivo.py;

This will have the specifications of what is being done by Pyinstaller;

Open the file . spec (can be with the notepad);

Go on 'COLLECT' and after exe, write Tree('Nome_da_pasta_onde_esta_seu_arquivo_kv\'),

Note: Do not forget the comma

Tell us if it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.