-   Programming (
-   -   best practices for subprocs & pipes in python (

bardinjw 11-28-2005 01:27 PM

best practices for subprocs & pipes in python
could some who keeps more up to date than i tell me what the current preferred way of running a sub process is in python?

should i be using os.popen, popen2, subprocess.Popen, etc?

and a similar question,

is it possible to create a pipe to just a shell, keeping it open for later commands?

i was trying to create a single object (e.g. shell) that i could read and write to, like a shell command line, something lie this


    shell.write('command -to run')
    output = shell.readlines()
    print 'this went wrong', shell.stderr

i tried this a few ways, and never could get all the pipes working. i either get file errors or it loops indefintely (atleast until i hit ctrl+c) while reading.

All times are GMT -5. The time now is 10:57 PM.