I have made a kivy app and packaged it as an executable file but for some reason the executable is only opening for a split second then closing without showing anything. I am sure none of my code is flawed as it works when ran in my text editor, what can I do to fix this issue?
Spec file-
from kivy_deps import sdl2, glew
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['C:\\Users\\Admin\\Assignment\\Info_Tech_Assignment.py'],
pathex=['C:\\Users\\Admin\\Desktop\\Tech'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='Info_Tech',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe, Tree('C:\\Users\\Admin\\Assignment\\'),
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
strip=False,
upx=True,
upx_exclude=[],
name='Info_Tech')
Python code -
import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.properties import StringProperty, ObjectProperty
import webbrowser
from kivy.uix.image import Image
from kivy.core.window import Window
import keyboard
class Login(Screen):
def validate(self):
user = self.ids.input_1
pwd = self.ids.input_pwd
info = self.ids.info
uname = user.text
passw = pwd.text
if uname == '' or passw == '':
info.text = '[color=#FF0000]Username or password needed[/color]'
else:
if uname == 'Savant' and passw == 'root':
self.parent.current = 'contentpage'
else:
info.text = '[color=#FF0000]Username or password is invalid[/color]'
pass
class TableOfContents(Screen):
pass
class WorldWideWeb(Screen):
def web(self):
webbrowser.open("https://en.wikipedia.org/wiki/Tim_Berners-Lee")
pass
class HypertextMarkupLanguage(Screen):
pass
class HypertextTransferProtocol(Screen):
pass
class Hyperlinks(Screen):
pass
class WebServer(Screen):
pass
class Webpage(Screen):
pass
class FileTransferProtocol(Screen):
pass
class WebBrowser(Screen):
pass
class UniformResourceLocator(Screen):
pass
class UploadandDownload(Screen):
pass
class Email(Screen):
pass
class Pictures(Screen):
pass
class References(Screen):
pass
class WindowManager(ScreenManager):
data_dir = App().user_data_dir
pass
kv = Builder.load_file("rtech.kv")
class info(App):
def build(self):
return kv
if __name__ == "__main__":
Window.maximize()
info().run()
keyboard.wait('esc')
I found the issue, it was because I was running the build
folder executable not the dist
folder executable, aparently it is a common error people make.