I have a python program that use kivy and create a gui. I tried to make the program an executable using pyinstaller but when I try to run the exe file it opens and closes the app immediately. I tried to run the exe using the cmd but it just opened it in another window and closed it immediately, I also tried using the -c flag when using pyinstaller on the .py file but there was no change. what can I do to solve it?
Edit:
I tried adding a print("hello") in the first line and then exit right after it, and then I created an exe again, but the result hasn't changed, the file opened and closed immediately. Therefore I tried running the app with with the cmd with start /B
forcing it to run in the cmd, I saw it got the following error
C:\Users\YShay\Desktop\New folder\dist>Traceback (most recent call last):
File "C:\Users\YShay\AppData\Local\Programs\Python\Python38\Lib\sitepackages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 13, in <module>
import pkg_resources as res
File "c:\users\yshay\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\pkg_resources\__init__.py", line 86, in <module>
ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
[19380] Failed to execute script pyi_rth_pkgres
Does it mean it pyinstaller failed to import one of the modules? If so how could I import it or make it accessible for the application?
Those are all the imports of my program:
import socket
import sys
import threading
import psutil
import socket
import subprocess
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from functools import partial