-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hi, I had problem with creating standalone executable, but I have figured it out. I am not confident to make a pull request, but I'd like to share it at least this way.
I am using auto-py-to-exe to make the binary both on Windows and Linux. The problem was:
- Missing dynamic library from webui
- Wrong path to web files - if you want them separately, like
examples/andershell3000
withui
folder, resulting in "Resource Not Available" at runtime window.
The solution to missing library was to adding this option in auto-py-to-exe: Advanced
➝ What to bundle, where to search
➝ --collect-binaries
type: webui
So the complete pyinstaller command was like this in my case: pyinstaller --noconfirm --onefile --windowed --add-data "/home/gordon/Dokumenty/PlatformIO/Projects/python-webui/examples/andershell3000/ui:ui/" --collect-binaries "webui" "/home/gordon/Dokumenty/PlatformIO/Projects/python-webui/examples/andershell3000/andershell3000.py"
Do not forget to add the ui
folder as well.
The solution to wrong webfile's path was to dynamically creating absolute path on runtime. Let's take examples/andershell3000/andershell3000.py
. By changing it like this:
import os
.
.
.
html_folder = os.path.join(os.path.dirname(__file__), "ui")
MyWindow.set_root_folder(html_folder)
.
.
.
the problem is gone. It took me quite some time to figure it out. Could you please review my approach and implement it if feasible?