Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eel not working when using cx_freeze #371

Open
kakaroto opened this issue Aug 2, 2020 · 3 comments
Open

eel not working when using cx_freeze #371

kakaroto opened this issue Aug 2, 2020 · 3 comments
Labels

Comments

@kakaroto
Copy link

kakaroto commented Aug 2, 2020

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.

@kakaroto kakaroto added the bug label Aug 2, 2020
@samuelhwilliams
Copy link
Collaborator

samuelhwilliams commented Aug 2, 2020

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

@kakaroto
Copy link
Author

kakaroto commented Aug 2, 2020

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!

kakaroto added a commit to kakaroto/Eel that referenced this issue Aug 4, 2020
cx_freeze frozen apps don't define/use _MEIPASS
Fixes python-eel#371
@funatsufumiya
Copy link

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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants