noob: subprocess clarification

moogyd at yahoo.co.uk moogyd at yahoo.co.uk
Sun Sep 14 11:29:52 CEST 2008


Hi,

I generally use csh scripts for generally scripting (controlling
simulations). Basically the script processing options, generates the
command line, executes it and then processes the results.

I would usually use the -f option on the shebang line to ensure that
the environment from the current shell is used.

i.e. #!/bin/csh -f

How do I acheive this in python?

I have been looking at the

import subprocess as sub
p = sub.Popen(['echo $PATH'],shell=True).wait()

This *seems* to do what I want (in that the path looks correct), but I
don't really understand the documentation.

Can somebody please clarify what the shell=True does, and whether I am
using it correctly.

Thanks,

Steven






More information about the Python-list mailing list