[Tutor] subprocess

kevin parks kp8 at mac.com
Sat Mar 27 08:55:15 CET 2010

I tried readings some toots and tried reading alan's thing. I just still can't grok how to use subprocess.

I am trying to call sox (fun fact: an early contributer to sox was none other than Guido van Rossum)

In the old days you would just use os i guess, like:

import os
os.system('sox -V3 -D -S St.01.aif -b16 Stout-01.aif rate -s -v 44100')

to call a unix executable that you would ordinarily run from the terminal.

what would the equivalent of this in python's new subprocess be? perhaps if i saw an example it would click..

additionally.. sox is a sound conversion tool. I plan to batch process a bunch of files. Will subprocess start all the jobs as it finds the files? or will it process one job and que the next? If it opened a thread and started a bunch of jobs it would likely bog down the system no?

anyway .... I have the os walk and other stuff that i am working on and i was hoping to get some help on subprocess. There are a few pages on subprocess but they all might just as well be in chinese and none of them, none that i can see are equivalent to what i am trying to do (they all seem to be doing os-y things)

An example might help. Not sure why i am finding this so hard to get my head around.

More information about the Tutor mailing list