Passing arguments to a command line from a python script

Luis M. González luismgz at gmail.com
Mon Mar 19 23:18:21 EDT 2007


On Mar 19, 11:52 pm, Steven Bethard <steven.beth... at gmail.com> wrote:
> Luis M. González wrote:
> > On Mar 19, 10:49 pm, "zacherates" <zachera... at gmail.com> wrote:
> >> This implies that `os.system("setuppy py2exe")` should do what you
> >> want.
>
> > It works!
> > Thank you, this is just what I wanted.
>
> You'll get better error checking if instead you do::
>
>      >>> import subprocess
>      >>> subprocess.call(['setup.py', 'py2exe'])
>
> Actually, you probably should really be doing::
>
>      >>> subprocess.call(['python', 'setup.py', 'py2exe'])
>
> so that you don't have to assume the OS knows how to run a .py file.
>
> STeVe

Noted.
Thanks STeVe!







More information about the Python-list mailing list