Here is the exception after running exe file packaged by pyinstaller from kivy app on windows 10 Traceback (most recent call last): File "try.py", line 1, in
import kivy
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "kivy\__init__.py", line 272, in <module>
File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 71, in _pyi_pkgutil_iter_modules
TypeError: startswith first arg must be str or a tuple of str, not PureWindowsPath
[6292] Failed to execute script 'try' due to unhandled exception!
And here is my try.py (Kivy app) '''
import kivy
kivy.require('2.0.0') # replace with your current kivy version !
from random import random
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.widget import Widget
from kivy.graphics import Color,Ellipse,Line
from kivy.uix.button import Button
class MyPaintWidget(Widget):
def on_touch_down(self,touch):
color=(random(),1.,1.)
with self.canvas:
Color(*color,mode="hsv")
d=30.
Ellipse(pos=(touch.x-d/2,touch.y-d/2),size=(d,d))
touch.ud['line']=Line(points=(touch.x,touch.y))
def on_touch_move(self,touch):
touch.ud['line'].points+=[touch.x,touch.y]
class MyApp(App):
def build(self):
parent=Widget()
self.painter=MyPaintWidget()
clearbtn=Button(text="Clear")
clearbtn.bind(on_release=self.clear_canvas)
parent.add_widget(self.painter)
parent.add_widget(clearbtn)
return parent
def clear_canvas(self,obj):
self.painter.canvas.clear()
if __name__ == '__main__':
MyApp().run()
''' Below is my try.spec file,with kivy_deps and glew added
# -*- mode: python ; coding: utf-8 -*-
from kivy_deps import sdl2,glew
block_cipher = None
a = Analysis(['C:\\Users\\25670\\kivy_venv\\try.py'],
pathex=['C:\\Users\\25670\\Desktop\\app'],
binaries=[],
datas=[],
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,Tree('C:\\Users\\25670\\kivy_venv\\'),
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins+glew.dep_bins)],
name='try',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )
I will be glad if you help me solve this problem it is ruining my life.Thanks