execute a shell script from a python script

Thomas Nelson thn at mail.utexas.edu
Mon Jul 17 16:48:22 EDT 2006


If your script is foo.sh and takes args:
import subprocess
subprocess.call(["foo.sh","args"],shell=True)
Should work fine.  check out
http://www.python.org/dev/doc/maint24/lib/module-subprocess.html

Enjoy,
THN

spec wrote:
> Hi all, I know nothing about Python. What I need to do is to get a
> Python script to execute a local shell script. I do not need any
> output. What would be th eeasiest way to accomplish this?
> 
> Thanks!




More information about the Python-list mailing list