Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

eel not working when using cx_freeze #371

Open

Description

@kakaroto

Eel version
master

Describe the bug
When using cx_freeze to freeze the app, it will fail to start due to sys._MEIPASS not being defined

Additional context
in eel/__init__.py , you check for whether the app was frozen in get_real_path and use sys._MEIPASS if that's the case. However, that only works specifically for pyinstaller. In the case of cx_freeze, the app is considered frozen but there is no _MEIPASS defined and you can use the path normally.

I tracked down the bug and the issue to a similar fix in another project and you can see their fix for it here :
https://github.com/bokeh/bokeh/pull/8324/files

Adding and hasattr(sys, '_MEIPASS'): to line 297 of init.py (https://github.com/samuelhwilliams/Eel/blob/master/eel/__init__.py#L297) fixed it for me and I can confirm that eel is working (and it's working great!)
I didn't feel like such a small change deserved for me to do a fork and PR but if you'd prefer I do that, let me know and I can send you a PR instead.

Activity

  1. samuelhwilliams commented on Aug 2, 2020

    @samuelhwilliams
    Collaborator

    Can I ask why you need to use cx_freeze rather than pyinstaller?

  2. kakaroto commented on Aug 2, 2020

    @kakaroto
    Author

    Because of the thousand users I've had, about 25% of them had issues with pyinstaller. For example, for some, it will simply not open anything, I've had to remote desktop into a user's PC and could not figure it out, the process starts then exits, no output in console, or anything. It also doesn't load at all for me if the exe is launched from within a network drive, also, I've had multiple times where the generated exe was getting flagged as a virus by various antivirus software, such as Windows Defender.
    I also need to generate a dmg for Mac builds, and I think pyinstaller only supports generating a .app, I like that cx_freeze can do the dmg process generation for as well.

    Overall, I've been using pyinstaller for nearly a year and grew tired of fighting against it, tried cx_freeze, it gives bigger files (a 300MB instead of 95MB directory) due to how it brings in pyside dependencies (still trying to figure out how to remove that dep), but otherwise, when pyinstaller wasn't working for people, cx_freeze was working fine. I gave pyinstaller a try, now I want to give cx_freeze a try.

    Regardless, there are multiple freezing choices in the python community, and giving the choice of the user seems sensible rather than forcing a single choice :)
    I hope that helps you understand why I made that choice.
    Thanks!

  3. added a commit that references this issue on Aug 4, 2020
    1aa0706
  4. ffunatsu commented on Nov 24, 2022

    @ffunatsu

    Can I ask why you need to use cx_freeze rather than pyinstaller?

    I use cx_freeze rather than pyinstaller in some cases. Pyinstaller executable sometimes takes much time to start up than cx_freeze.

    I created another pull request.
    #635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions