Pipes

Cameron Simpson cs at zip.com.au
Mon Aug 10 00:52:14 EDT 2015


On 09Aug2015 20:55, Roger Hunter <rogerh906 at gmail.com> wrote:
>I agree that some of Python is simple but the description of subprocess is
>certainly not.

It depends, to a degree. Subprocess embodies, in a fairly portable way, the 
mechanisms for starting an external command and connecting to it, and has a few 
convenience routes for the common cases of that interaction, such as the 
check-call() function.

It does expect the user to have some familarity with pipes and the whole 
"process" model, and describes what it offers.

If you want to make pipelines or do other higher level things built on 
subprocesses then either your should use subprocess to assemble that pipeline 
yourself (which is not incredibly hard, but I would hardly call trivial and
convenient) or reach for a third party wrapper aimed at larger goals than 
subprocess' "single external process" focus.  For example, the "sarge" module:

  http://sarge.readthedocs.org/en/latest/index.html

It is not part of the standard library, but it is available from PyPI:

  https://pypi.python.org/pypi/sarge/

which makes fetching and installing it very easy. There are doubtless other 
libraries written to similarly ease more complicated subprocess-based 
operations. Using PyPI's search field with the word "subprocess" lists many 
many modules, several of which might be suited to specific goals.

>I spent much of my working career using Fortran and TrueBasic on mainframes.

Did either make spawning subcommands and collecting their output, or passing 
them some input, easy?

>I'd like programming to be more like holding a discussion to the computer
>in English instead of Sanscrit.

Actually, Python is far far more like English pseudocode than most other 
languages in my experience. And a much better attempt than other "let the user 
write plain English" attempts like COBOL or SQL (less proselike, but definitely 
of that aim).

There is of course Elisa :-)

  https://pypi.python.org/pypi/babbler/

Though it isn't programming...

Cheers,
Cameron Simpson <cs at zip.com.au>

My computer always does exactly what I tell it to do but sometimes I have
trouble finding out what it was that I told it to do.
        - Dick Wexelblat <rlw at ida.org>



More information about the Python-list mailing list