Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95213

Re: Pipes

Path csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'model,': 0.05; 'wrapper': 0.07; 'cc:addr:python-list': 0.09; 'input,': 0.09; 'output,': 0.09; 'portable': 0.09; 'roger': 0.09; 'python': 0.10; ':-)': 0.12; '>in': 0.16; 'degree.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'interaction,': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'module:': 0.16; 'modules,': 0.16; 'pipelines': 0.16; 'pipes': 0.16; 'simpson': 0.16; 'subprocess': 0.16; 'wrote:': 0.16; 'library,': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'do.': 0.22; 'fairly': 0.22; 'libraries': 0.22; 'cheers,': 0.22; 'cc:no real name:2**0': 0.22; 'programming': 0.22; 'ease': 0.23; 'passing': 0.23; 'plain': 0.24; 'written': 0.24; 'header:In-Reply- To:1': 0.24; 'discussion': 0.24; 'header:User-Agent:1': 0.26; 'command': 0.26; '(which': 0.26; 'external': 0.27; 'not.': 0.27; 'collecting': 0.27; 'convenience': 0.29; 'url:python': 0.33; 'third': 0.33; 'common': 0.33; 'operations.': 0.33; 'languages': 0.34; 'lists': 0.34; 'trouble': 0.35; 'attempt': 0.35; 'installing': 0.35; 'level': 0.35; "isn't": 0.35; 'sometimes': 0.35; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'there': 0.36; 'url:org': 0.36; 'cases': 0.36; 'subject:: ': 0.37; 'agree': 0.37; 'expect': 0.37; 'charset:us-ascii': 0.37; 'starting': 0.37; 'things': 0.38; 'several': 0.38; 'url:en': 0.39; 'does': 0.39; 'some': 0.40; 'field': 0.60; 'your': 0.60; 'reach': 0.61; 'course': 0.62; 'more': 0.63; 'experience.': 0.66; 'cameron': 0.66; 'goals': 0.67; 'url:index': 0.67; 'received:61': 0.72; 'suited': 0.72; 'yourself': 0.73; 'incredibly': 0.76; 'actually,': 0.84; 'assemble': 0.84; 'cobol': 0.84; 'hardly': 0.84; 'hunter': 0.84; 'url:readthedocs': 0.84; 'pipeline': 0.91; 'url:latest': 0.91
X-Authentication-Info Submitted using ID cskk@bigpond.com
X-Authority-Analysis v=2.0 cv=Os7NOlDt c=1 sm=1 a=chXZfFBfnOKVgXIVRPl8ew==:17 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=yEdEr6MRgwAA:10 a=uRRa74qj2VoA:10 a=pGLkceISAAAA:8 a=MbBU0op5AAAA:8 a=8AHkEIZyAAAA:8 a=dBhzj_v1AAAA:8 a=8SRGmaGza_bQ7-VdYsYA:9 a=CjuIK1q_8ugA:10 a=chXZfFBfnOKVgXIVRPl8ew==:117
Date Mon, 10 Aug 2015 14:52:14 +1000
From Cameron Simpson <cs@zip.com.au>
To Roger Hunter <rogerh906@gmail.com>
Cc python-list@python.org
Subject Re: Pipes
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Disposition inline
In-Reply-To <CACDQb4hG39=h1YZS7-QXKgzO=A5Pp-7oTB784Cy+436iFv1E=g@mail.gmail.com>
User-Agent Mutt/1.5.23 (2014-03-12)
References <CACDQb4hG39=h1YZS7-QXKgzO=A5Pp-7oTB784Cy+436iFv1E=g@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.26.1439184522.3627.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1439184522 news.xs4all.nl 2895 [2001:888:2000:d::a6]:35846
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95213

Show key headers only | View raw


On 09Aug2015 20:55, Roger Hunter <rogerh906@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@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@ida.org>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pipes Cameron Simpson <cs@zip.com.au> - 2015-08-10 14:52 +1000

csiph-web