execute a shell script from a python script
Thomas Nelson
thn at mail.utexas.edu
Tue Jul 18 13:21:36 EDT 2006
As described in the docs I pointed to before:
subprocess.call("foo.sh",shell=True)
Is the way to do it without args. I think it is simplest to learn the
subprocess module because (quoting from the docs) this module intends
to replace several other, older modules and functions, such as:
os.system
os.spawn*
os.popen*
popen2.*
commands.*
This way you only need to learn one thing. Actually I would like to
see some of these older functions deprecated.
THN
Cameron Laird wrote:
> In article <1153187926.407414.201530 at m73g2000cwd.googlegroups.com>,
> Simon Forman <rogue_pedro at yahoo.com> wrote:
> >spec wrote:
> >> Thanks, actually there are no args, is there something even simpler?
> >>
> >> Thanks
> >> Frank
> >
> >you could try os.system()
> >
> >>From the docs:
> >
> >system(command)
> .
> [more detail]
> .
> .
> I'm concerned the follow-ups in this thread have been too subtle.
> Here is what you need to know: use system(). A model such as
>
> import os
> os.system("my_script")
>
> fulfills exactly the requirements the original poster described.
More information about the Python-list
mailing list