I've packaged my Kivy App with PyInstaller with the following cmd line:
pyinstaller --onefile -w --icon=Pi.ico --add-data TheGUI.kv;. main.py
I had to copy some libraries to my dist directory in order for my .exe to work. I used this youtube video for help, for me it works perfectly fine. I didn't make any changes to my spec file, it looks like this:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['C:\\Users\\... here is the pyth to my directory '],
binaries=[],
datas=[('TheGUI.kv', '.')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
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,
a.binaries,
a.zipfiles,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None , icon='Pi.ico')
My .exe file runs perfectly on my laptop, but if I try to run my app on a virtual PC with Windows 10, I get
Failed to execute script 'main' due to unhandled exception: 'NoneType' object has no attribute 'size'
Failed to obtain/convert traceback!
I also tried to run the python code from the command line on the virtual PC and it works just fine. I only get this error if I try to start the .exe file.
The 'size' in the error refers to the first line in my code:
import os
import sys
from kivy.app import App
from kivy.properties import StringProperty, BooleanProperty
from kivy.uix.boxlayout import BoxLayout
import socket
import re
import threading
from kivy.core.window import Window
import socket_names
Window.size = (1300, 700)
I know there is a similar question, but the problem is not quite the same.
Anyone had the same problem, or a similar one?