Getting error while creating exe from python kivy code

32 views
Skip to first unread message

shobin b

unread,
Mar 22, 2023, 7:15:00 AM3/22/23
to Kivy development
Hi,

I tried to create exe from my python kivy code and i can able to create exe with console(means console also opening parallely). So what i need is without console the exe should work. But when i try the command --noconsole or --w or --windowed these commands i am facing error. Please help me here.

The below coomands i tried,
> pyinstaller --onefile --noconsole --add-data=SystemsEOL_.kv;. --add-data=EmersonAPI.py;. --add-data=hpxlogo.jpg;. --add-data=i_o.png;. --add-data=PV.jpg;. --add-data=run_test.jpg;. --add-data=units.csv;. Main.py

then in Main.spec file added below things,

from kivy_deps import sdl2, glew

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
    [],

>pyinstaller --clean "Main.spec"


exe_error.PNG

Peter Pacsay

unread,
Mar 22, 2023, 1:34:00 PM3/22/23
to kivy...@googlegroups.com
Hi,

Your kivy python app has to include:
# no console – be sure your app does not include any command that uses # console (e.g. “print”)
os.environ["KIVY_NO_CONSOLELOG"] = "1"

You need in spec file - console: False

You can find many useful information in comment Peter Pacsay if you read it patiently:

Hope to help

Peter

--
You received this message because you are subscribed to the Google Groups "Kivy development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-dev/2321b758-f397-4204-bc52-8d58ee67eaf3n%40googlegroups.com.

Peter Pacsay

unread,
Mar 22, 2023, 1:47:23 PM3/22/23
to kivy...@googlegroups.com
Hi,

The logic is: It is ok that you do not use any command like "print" in your app, and it is ok that you ask in spec file not to use console, but your IDE, like PyCharm uses console for error, warning, ... messages when you run your app. So the "os.environ["KIVY_NO_CONSOLELOG"] = "1" can help in it.

Your kivy python app has to include:
# no console – be sure your app does not include any command that uses # console (e.g. “print”)
os.environ["KIVY_NO_CONSOLELOG"] = "1"

You need in spec file - console: False

In this topic You can find some useful information in comment Peter Pacsay if you read it patiently:

Peter P

On Wed, 22 Mar 2023 at 12:15, shobin b <shob...@gmail.com> wrote:

shobin b

unread,
Mar 23, 2023, 12:45:29 AM3/23/23
to Kivy development
Hi Peter,

Thanks for your time. I tried the steps that you mentioned but still facing error.

Peter Pacsay

unread,
Mar 23, 2023, 7:55:18 AM3/23/23
to kivy...@googlegroups.com
Hi,

I did not use --onefile, I used -- onedir. I did not use cmd or bash only for --onedir command and I wrote  my more requirements into the spec file. If you wrote my comment on the page I mentioned inbetween my letters. You will see the differents. It results one exe file without storefile.
I ám sorry if I could not help you.
I had been working for two week in January with my conditions in order my app to work as exe.
Best regards,
Peter

Reply all
Reply to author
Forward
0 new messages