Python as a scripting language. Alternative to bash script?

Michael Torrie torriem at gmail.com
Wed Jul 7 11:31:02 EDT 2010


On 07/06/2010 09:34 PM, Chris Rebert wrote:
> On Tue, Jul 6, 2010 at 6:40 AM, Michael Torrie <torriem at gmail.com> wrote:
>> While it's possible to set up pipes and spawn programs in parallel to
>> operate on the pipes, in practice it's simpler to tell subprocess.Popen
>> to use a shell and then just rely on Bash's very nice syntax for setting
>> up the pipeline.
> 
> Until there's a Python variable involved that is, unless you want to
> overlook all the edge cases or do the escaping all by yourself (and
> then pray you did it right).

Very good point.  This is a problem that the pipes module suffers from
as well.

Although we learned in the other thread on escaping SQL statements that
escaping is faster, easier and just as safe as other parameterization
mechanisms.  Uh huh.

Back on target, a library similar to pipes that was safe (pipes is not)
and had a pythonic syntax would be cool.  pipes module works alright,
syntax wise, but it's not a clean syntax.



More information about the Python-list mailing list