Python: py2exe setup file example

Tuesday, April 15th, 2008
Advertisement

Subscribe.
Enter your email:

py2exe is a Python package that can convert Python scripts into executable Windows programs. This is an example of py2exe setup file.

from distutils.core import setup
import py2exe
import sys

# no arguments
if len(sys.argv) == 1:
    sys.argv.append("py2exe")

def compile(appName, console=False):
    OPTIONS = {"py2exe": \
               {"compressed": 1, "optimize": 0, "bundle_files": 1, } }
    ZIPFILE = None

    if console:
        setup(
            options=OPTIONS,
            zipfile=ZIPFILE,
            console=[appName]
        )
    else:
        setup(
            options=OPTIONS,
            zipfile=ZIPFILE,
            windows=[appName]
        )

compile(‘example.py’)
If you are new here, you might want to subscribe to the RSS feed or newsletter.

Enter your email address:

Creates the exact copy of your hard disk and allows you to instantly restore the entire machine.
New Acronis True Image Home 2010 is the most reliable and easy in use backup solution. Now with online backup option!
15% Discount Code: FMAATIH2010

What else?

Like this article? Share it

 Digg  del.icio.us  TwitThis  Facebook  Reddit  StumbleUpon

One Response to “Python: py2exe setup file example”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>