António Rocha wrote:

> > Check the exit code from the command. Commands should use a non-zero
> > exit code if there was an error.
> >
> > It would help to know exactly how the command is being run.
> >
> >   
> 
> Hi,
> You are absolutely right :)
> Among others, I'm using:
> grass.run_command("r.in.gdal", flags= 'k', overwrite = 'o', input = src_file, 
> output = target_file)

        if grass.run_command(...) != 0:
            grass.fatal(...)

run_command and write_command return the exit code.

start_command, pipe_command, and feed_command return the Popen object;
you can check its .returncode attribute once it has terminated.

read_command and parse_command return the data written to the child's
stdout; there isn't any mechanism to retrieve the exit status for
these. OTOH, read_command is trivial to implement yourself if you need
this.

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

Reply via email to