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

cx_freeze support in addition to PyInstaller #465

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

grokwithrahul
Copy link

I built my eel application using cx_freeze instead of PyInstaller, then realized that PyInstaller-specific variables were hardcoded into init.py. In the function _get_real_path, sys.frozen is used by both cx_freeze and PyInstaller. However, sys._MEIPASS is a variable that only PyInstaller uses (to store the current path of the folder). I added support to allow the users to say what their application is frozen with, during the eel.init(), with the variable frozen_with.

Comment on lines +311 to +314
if frozen_with == 'cx_freeze':
return os.path.join(sys.executable, path)
elif frozen_with == 'PyInstaller':
return os.path.join(sys._MEIPASS, path)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be easier to just do

Suggested change
if frozen_with == 'cx_freeze':
return os.path.join(sys.executable, path)
elif frozen_with == 'PyInstaller':
return os.path.join(sys._MEIPASS, path)
return os.path.join(getattr(sys, '_MEIPASS', sys.executable), path)

That way, user can seemlessly switch between the two

@samuelhwilliams
Copy link
Collaborator

Is there some benefit from using cx_Freeze over PyInstaller?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants