[GRASS-dev] How to get stop a script with an error in a function

Martin Landa landa.martin at gmail.com
Fri Oct 15 11:00:28 EDT 2010


Hi,

2010/10/15 António Rocha <antonio.rocha at deimos.com.pt>:
> check_process=grass.run_command("r.in.gdal", flags= 'k', overwrite = 'o',
> input = src_file, output = target_file)   if check_process=0:
>  gdal_fatal (_("ERROR"))

no, '0' means success, non-zero code is usually used for failure. Also
use '==' in conditions, so

ret = grass.run_command(...)
if ret != 0:
    grass.fatal('error')

Martin

-- 
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


More information about the grass-dev mailing list