Search code examples
pythonpyinstallerkivy-language

PyInstaller Error: FileNotFoundError: [Errno 2] No such file ot directory: 'myKivyfile.kv'


So I have tried to get my python / kivy project into a standalone "exe". I succeeded in making it "onedir" but after it compiled (with no errors) into a single exe, it doesn't work. The app window just flashes and closes. Command I put in to compile: pyinstaller --onefile -w --icon=download.ico --debug=all --add-data filefinder.kv;. filefinder.py. I added the debug flag to figure out what's causing it to crash and got the following window errors:

Failed to execute script pyiboot01_bootstrap

Error: 'NoneType' object has no attribute 'write'

Traceback: ['Traceback (most recent call last):\n', ' File 
"Pyinstaller\\loader\\pyiboot01_bootstrap.py", line 20, in <module>\n', ' File]

The full 3rd error

full

For troubleshooting purposes I also compiled it in a windowless mode to get the command prompt output and hopefully shed some light and this issue and in one line I found this gem:
FileNotFoundError: [Errno 2] No such file ot directory: 'filefinder.kv'

So it has something to do with my ".kv" file. The problem is, I don't know what! I have read the docs on what to do when things go wrong but it didn't help me. So I am asking for your help. I am happy to provide any information you may need.

Additional info: Python: 3.9.1 System: Windows 10 Pro Kivy: 2.0.0 Pyinstaller: Latest 5.0 (experimental) I have tried the stable version but got the same results

Cheers!


Solution

  • Solved it myself! (8 months ago). All right, I know this answer is really late, but in case that someone stumbles upon this issue, I want them to know the solution.

    The issue is caused by the lack of kivy libraries which you need to copy to the folder in which your .exe file is.

    You can download these libraries from my github here: https://github.com/6outtaTen/kivy_libs

    Also if you want to see me explain this topic and issue in depth, you can watch my video on YouTube:

    How to make a standalone exe file from your kivy project! 2021