Ned Horning wrote:

> I'm making progress translating my shell script to Python but ran into 
> another stumbling block. I would like to convert the following shell 
> script command to the python scrip:
> --
> v.out.ascii $randomName fs=' ' | r.what  input=$resampName> $pointTableName
> --
> 
> I tried various combinations of grass.pipe_command and 
> grass.feed_command but haven't been able to get it to work.

Using pipe_command() and feed_command() will give you two pipes (one
each), but you only want one. Use start_command():

        outf = file(pointTableName, 'w')
        p1 = grass.pipe_command('v.out.ascii',
                input = randomName,
                fs = ' ')
        p2 = grass.start_command('r.what',
                input = resampName,
                stdin = p1.stdout,
                stdout = outf)
        outf.close()
        p1.stdout.close()
        p1.wait()
        p2.wait()

start_command() is the most general function; all of the others
(except exec_command()) end up invoking start_command().

-- 
Glynn Clements <gl...@gclements.plus.com>
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to