selinap.com

To leave furtively and stealthily.

Home » Python

Python: py2exe setup file example

April 15th, 2008

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)

Related Articles:

Popular Articles:

Spread/Promote this article.

Digg | Del.icio.us | Stumble | Y! MyWeb | Y! Buzz | Fave It! | Reddit

Subscribe for free.

 Subscribe to Selinap.com feed right now!

 Get Updates by Email

Tags: ,

One Response to “Python: py2exe setup file example”

  1. qadrina says:

    Good info.

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> <pre lang="" line="">


© Copyright 2008 - 2009 selinap.com
Entries (RSS) and Comments (RSS).