One of the thing added in python 2.6 is the subprocess module. To start use it
import subprocess
to use it, after the import, run this
for example to call some unix command
or in my case, i use it to run setup.py in bootstrap script for virtualenv
Just a little writeup of subprocess, probably gonna use this a lot
import subprocess
to use it, after the import, run this
subprocess.call(['programname','parameter1','parameter2'......])
for example to call some unix command
subprocess.call(['ls','-l'])
subprocess.call(['ps','-aux'])
or in my case, i use it to run setup.py in bootstrap script for virtualenv
subprocess.call(['python','setup.py','install'])
subprocess.call(['easy_install','-U','packagename'])
Just a little writeup of subprocess, probably gonna use this a lot
No comments:
Post a Comment