Passing arguments to a command line from a python script

Luis M. González luismgz at gmail.com
Mon Mar 19 19:46:56 EDT 2007


Please forgive me if what I'm asking is non sense...

I created a little program to authomate the creation of the "setup.py"
script for py2exe.
It simply prompts for the main executable script name and then creates
setup.py, as follows:

# this is "makesetup.py"

nombre = raw_input('File name?: ')

f = open('setup.py', 'w')

f.write('''
from distutils.core import setup
import py2exe

setup( name = "%s",
        windows = ["%s.pyw"],
        data_files = [ (".", ["%s.rsrc.py"]) ]
        )
''' %(nombre, nombre, nombre))

f.close()

# end of script

What I want now is execute the script I just created.
As far as I know, the only way to execute the script is from a command
line and typing "setup.py py2exe".

Can I do this authomatically right from my program?
If so, how?

Any hint would be highly appreciated...
regards,
Luis




More information about the Python-list mailing list