[Tutor] pipes, lots of 'em

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 13 Mar 2001 22:39:44 -0800 (PST)


On Tue, 13 Mar 2001, Sean 'Shaleh' Perry wrote:

> So I am writing this program and I need to run several programs from within it
> and read their output something like:
> 
> foo | bar | baz # I want the output of baz.
> 
> I do not necessarily know how many programs will be run at once in this way.
> 
> I know about os.popen(), but is the best approach really:
> 
> command = '%s | %s' % (one, two) # assuming only two commands (common case)
> os.popen(command)
> 
> if I could somehow manipulate tar and ar files directly in python, I would not
> really need this.


Hmmm... don't know about the pipes thing, but I did find a module that
will let you read tar archives:

    http://www.faqts.com/knowledge_base/view.phtml/aid/4395

Haven't played around with it yet though.

I'm very surprised not to easily find a full tar program for Python
though; perhaps someone else can verify this?