For some odd reason I love doing this...
1) Save this code and run it as is
2) Screen instructions *should* be intuitive
enough
3) When entering file name, include extension (it uses the
difference between py and pyw to know if it needs console)
4) When done, there should be two new folders in the directory
with the file you made exe
build is not needed for the
execute
Every file in dist is necessary for
your exe (okay, well, maybe not *every* file)
##### setup.py ################
from distutils.core import setup
import py2exe import os,sys def selectdir():
c2 = os.getcwd() while 1: old = c2 print "Current directory is: %s" % c2 current = raw_input("Enter new directory or 'stop' if dir okay. ") if current in ('stop','n','quit'): break elif current == '': c2 = default elif current == 'look': printlines(os.listdir(c2)) elif current.startswith("chdir "): c2 = current[5:] else: c2 = os.path.join(c2,current) if not os.path.isdir(c2): n = raw_input("Directory does not exist. Create? ") if n == 'quit': raise SystemExit elif n == 'y': os.mkdir(c2) elif n == 'n': c2 = old os.chdir(c2) zipfi = None
if len(sys.argv) == 1:
sys.argv.append("py2exe") ## sys.argv.append('--xref') selectdir()
listed = [] listed2 = [] while 1: ask = raw_input('What is the file you want as an executable or \'stop\'? ') if ask in ['quit','stop','']: break else: if os.path.splitext(ask)[1] == '.pyw': listed2.append(ask) else: listed.append(ask) setup(console = listed,
windows = listed2, zipfile = zipfi) ############################# Good luck,
Jacob Schmidt
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor