Skip to content

Creating standalone executable - possibly SOLVED #38

@triuk

Description

@triuk

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:

  1. Missing dynamic library from webui
  2. Wrong path to web files - if you want them separately, like examples/andershell3000 with ui folder, resulting in "Resource Not Available" at runtime window.

The solution to missing library was to adding this option in auto-py-to-exe: AdvancedWhat 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions