Re: subprocess woes

2009-09-15 Thread kj
In Chris Rebert writes: >On Tue, Sep 15, 2009 at 12:26 PM, kj wrote: >> I'm trying to write a function, sort_data, that takes as argument >> the path to a file, and sorts it in place, leaving the last "sentinel" >> line in its original position (i.e. at the end). =C2=A0Here's what I >> have (o

Re: subprocess woes

2009-09-15 Thread Chris Rebert
On Tue, Sep 15, 2009 at 12:26 PM, kj wrote: > I'm trying to write a function, sort_data, that takes as argument > the path to a file, and sorts it in place, leaving the last "sentinel" > line in its original position (i.e. at the end).  Here's what I > have (omitting most error-checking code): > >

Re: subprocess woes

2009-09-15 Thread kj
Upon re-reading my post I realize that I left out some important details. In kj writes: >I'm trying to write a function, sort_data, that takes as argument >the path to a file, and sorts it in place, leaving the last "sentinel" >line in its original position (i.e. at the end). I neglected to

Re: subprocess woes

2009-09-15 Thread kj
In Mike Driscoll writes: >On Sep 15, 2:26=A0pm, kj wrote: >> I'm trying to write a function, sort_data, that takes as argument >> the path to a file, and sorts it in place, leaving the last "sentinel" >> line in its original position (i.e. at the end). =A0Here's what I >> have (omitting most e

Re: subprocess woes

2009-09-15 Thread Christian Heimes
Mike Driscoll wrote: > You can use cStringIO to create a "file-like" object in memory: > > http://docs.python.org/library/stringio.html No, you can't with subprocess. The underlying operating system API requires a file descriptor of a real file. Christian -- http://mail.python.org/mailman/list

Re: subprocess woes

2009-09-15 Thread Mike Driscoll
On Sep 15, 2:26 pm, kj wrote: > I'm trying to write a function, sort_data, that takes as argument > the path to a file, and sorts it in place, leaving the last "sentinel" > line in its original position (i.e. at the end).  Here's what I > have (omitting most error-checking code): > > def sort_data

Re: subprocess woes

2006-08-30 Thread km
Hi Dennis,   That works great. thanks for the correction. The 'output' variable has the returned data as string obbject. how can i get it as a list object with elements as line by line? Is it that p1.communicate()[0] by default returns a single string only ? regards, KM  On 8/29/06, Dennis Lee Bieb

Re: subprocess woes

2006-08-30 Thread km
Hi Dennis, That works great ! thanks for the correction regards, KM-- On 8/29/06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: On Tue, 29 Aug 2006 18:17:47 +0530, km <[EMAIL PROTECTED] >declaimed the following in comp.lang.python:> ##code star

Re: subprocess woes

2006-08-29 Thread Simon Forman
Dennis Lee Bieber wrote: > On Tue, 29 Aug 2006 18:17:47 +0530, km <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > ##code start ## > > import subprocess as sp > > x = 'GSQIPSHYWKKNLWYYSHEIDGGCHNMW' > > p0 = sp.Popen(["echo",x], stdout=sp.PIPE) > > Why use this