Returning Values from Bash Scripts

Fredrik Lundh fredrik at
Sun Jan 8 21:58:12 CET 2006

Steven D'Aprano wrote:

> >> How to execute bash scripts from python (other than using os.popen) and
> >> get the values that those bash scripts return.
> >
> > The easy way is to call it with
> >>> import subprocess
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named subprocess
> It might be easy, but an awful lot of people won't be using a version of
> Python that has the subprocess module, and for them upgrading may not be
> easy (or even possible) at all.

subprocess is available as a separate distribution for Python 2.2
and newer:

if you're on a unixoid system, all you need is the
file, which you can also get directly from the Python SVN:


More information about the Python-list mailing list