Re: piping with subprocess

2014-02-01 Thread Peter Otten
Rick Dooling wrote: > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: >> Try to convert the example from the above page >> >> """ >> output=`dmesg | grep hda` >> # becomes >> p1 = Popen(["dmesg"], stdout=PIPE) >> p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) >> p1.

Re: piping with subprocess

2014-02-01 Thread Mark Lawrence
On 01/02/2014 15:35, Rick Dooling wrote: Okay, blank lines removed. Apologies. I didn't know Google inserted them. RD No problem, the whole snag is people don't know about this flaw in this tool until they're told about it. -- My fellow Pythonistas, ask not what our language can do for yo

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 8:00:59 AM UTC-6, Rick Dooling wrote: > On Saturday, February 1, 2014 7:54:34 AM UTC-6, Rick Dooling wrote: > > > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > > > > Rick Dooling wrote: > > > > > I spent half a day trying to convert this bash

Re: piping with subprocess

2014-02-01 Thread Mark Lawrence
On 01/02/2014 13:54, Rick Dooling wrote: On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: Rick Dooling wrote: I spent half a day trying to convert this bash script (on Mac) textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 into Python using

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 7:54:34 AM UTC-6, Rick Dooling wrote: > On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > > > Rick Dooling wrote: > > > > > > > > > > > > > I spent half a day trying to convert this bash script (on Mac) > > > > > > > > > > > > > > text

Re: piping with subprocess

2014-02-01 Thread Rick Dooling
On Saturday, February 1, 2014 6:54:09 AM UTC-6, Peter Otten wrote: > Rick Dooling wrote: > > > > > I spent half a day trying to convert this bash script (on Mac) > > > > > > textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 > > > > > > into Python using subprocess pipes.

Re: piping with subprocess

2014-02-01 Thread Daniel da Silva
Try this: from subprocess import check_output import sys check_output("textutil -convert html %s -stdout | pandoc -f html -t markdown -o %s" % sys.argv[1:3], shell=True) On Sat, Feb 1, 2014 at 7:19 AM, Rick Dooling wrote: > I spent half a day trying to convert this bash script (on Mac) > > t

Re: piping with subprocess

2014-02-01 Thread Peter Otten
Rick Dooling wrote: > I spent half a day trying to convert this bash script (on Mac) > > textutil -convert html $1 -stdout | pandoc -f html -t markdown -o $2 > > into Python using subprocess pipes. > > It works if I save the above into a shell script called convert.sh and > then do > > subproc