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

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants