TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.84k stars 1.02k forks source link

Problems with compiling a project that uses customtkinter using PyInstaller #2336

Closed Eduard0110 closed 3 months ago

Eduard0110 commented 3 months ago

I was trying to compile my project using PyInstaller with --onefile prefix but failed. This is the error I got

Traceback (most recent call last): File "customtkinter\windows\widgets\theme\__init__.py", line 5, in <module> File "customtkinter\windows\widgets\theme\theme_manager.py", line 20, in load_theme FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\EDUARD~1\\AppData\\Local\\Temp\\_MEI98762\\customtkinter\\assets\\themes\\blue.json'

So i tried to compile it without the --onefile prefix and got this error

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\Password manager\\compiled\\customtkinter\\assets\\themes\\blue.json' The .json theme file for CustomTkinter could not be found. If packaging with pyinstaller was used, have a look at the wiki: https://github.com/TomSchimansky/CustomTkinter/wiki/Packaging#windows-pyinstaller-auto-py-to-exe The problem is just with the theme.json file that it can't find. So I opened the python folder and found the custom tkinter folder in the site-packages. Coppied it into my project so that the paths matched and run the program perfectely with no issues or errors. Without the customtkinter folder in my project it didn't work and I wonder why pyinstaller didn't create this folder with all the necessary files and how to fix this? Similar issue when trying to compile the project with --onefile prefix.

P.S. I know the description is a bit too long but any help would much appriciated! Thanks for reading

dipeshSam commented 3 months ago

Following may help you:

Eduard0110 commented 3 months ago

The way I did it is the only way to compile it. My solution was the same as described on https://github.com/TomSchimansky/CustomTkinter/wiki/Packaging#windows-pyinstaller-auto-py-to-exe