TkinterEP/ttkwidgets

CheckboxTreeview error using pyinstaller

Closed this issue · 5 comments

Hello, this is my first time using github.....
So I use checkboxtreeview in my project, and try to make an exe using pyinstaller. But this error came out:

Traceback (most recent call last):
  File "main.py", line 896, in <module>
  File "site-packages\ttkwidgets\checkboxtreeview.py", line 49, in __init__
  File "site-packages\PIL\Image.py", line 2634, in open
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\....\\AppData\\Local\\Temp\\_MEI46002\\ttkwidgets\\assets\\checked.png'
[5880] Failed to execute script main

Please help,
Thank you

j4321 commented

It seems to me that the images from the assets/ folder in ttkwidgets module (checked.png, unchecked.png and tristate.png) have not been packaged by pyinstaller. You will probably have to explicitly ask pyinstaller to include them, maybe as data files. I don't have Windows so I cannot do any test.

Thank you for opening an issue, @Zavierus.
@j4321 is correct: The data folder is not packaged by pyinstaller, as was also the case for ttkthemes. The solution is to make a simple change in your packaging process as also mentioned in that thread. That should make your package work, for now.
I will see if I can get a hook for ttkwidgets included in the pyinstaller project similar to the one for ttkthemes, which should fix the issue within pyinstaller itself and thus fix this issue for everyone.

Thank you @j4321 and @RedFantom,
I've fixed the problem 😄

That is good to hear! In the mean-time, I will leave this issue open as a reminder of the problem.

The PR has now been merged, so with the next release of PyInstaller the issue should be fixed and everything should work without intervention.