Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Freezing code to .exe
#3
Quote:Also it wants to put every python file that comes with python into the zip file that is created even though I don't use all of that in my program
i always just include it all into the exe. Dont quote me on this, but i think i recall there is no same option for cx freeze? I mean to the point where you just are left with the exe and nothing else. Its been a long time since i used it.

You can use exclude to disallow python modules to be added

This is my setup file for py2exe which zipfile None puts it into the exe, and compressed puts all the DLL's the other stuff into the exe. The only thing i have to worry about is the resources for my game. The hassle of splitting out the DLL's and python intepreter isnt worth it for small games. I also think it makes it easier for uber noobs to figure out, etc.

This is setup is specifically tailored for pygame too. 
import os
import sys
import py2exe
from distutils.core import setup

origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
    dlls = ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll")
    if os.path.basename(pathname).lower() in dlls:
        return 0
    return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

sys.argv.append('py2exe')
setup(options={'py2exe': {'bundle_files': 1, 'compressed': True}},
      windows=[{'script': "game.py"}],
      zipfile=None)
I normally could care less about the version/desc, and just glad that the exe works. But i use time as the version and to keep track of exe age as you will see in the following links

another py2exe setup example
https://github.com/metulburr/random/blob..._py2exe.py

cxfreeze setup
https://github.com/metulburr/random/blob...xfreeze.py
Recommended Tutorials:
Reply


Messages In This Thread
Freezing code to .exe - by LavaCreeperKing - Nov-16-2016, 09:57 PM
RE: Freezing code to .exe - by nilamo - Nov-16-2016, 10:38 PM
RE: Freezing code to .exe - by metulburr - Nov-16-2016, 10:56 PM
RE: Freezing code to .exe - by LavaCreeperKing - Nov-17-2016, 09:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  While Loop Variable Freezing? stylingpat 13 6,645 Feb-25-2021, 10:42 AM
Last Post: Abdullah

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020