Search code examples
pythonkivytypeerrorpyinstaller

After I convert PY to EXE using PyInstaller it throw error


after I converted my PY file to EXE and I ran it, I got this error:

Traceback (most recent call last):
  File "PrngCipher.py", line 2, in <module>
    from kivy.app import App
  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 "C:\Program Files\Python39\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 71, in _pyi_pkgutil_iter_modules
    assert pkg_path.startswith(SYS_PREFIX)
TypeError: startswith first arg must be str or a tuple of str, not PureWindowsPath

I'm new to Python and PyInstaller, I don't know what this error is about, I followed many tutorials and hooked the right dependencies into the .spec file but it still broke. My .py, .kv and .spec file: https://drive.google.com/drive/folders/1F7I4xEphB3d2ErDPs7vGDpT7trTmHKgC?usp=sharing


Solution

  • I did more research and looked into the upper lines of the error message and I found out the problem was at the PyInstaller pakage's code not my code, the fix is to downgrade PyInstaller to 4.3 waiting for a fix using python -m pip install PyInstaller==4.3 and it worked fine