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

António Rocha antonio.rocha at deimos.com.pt
Fri Oct 15 10:55:14 EDT 2010


*Glynn Clements* 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)    

Shall I do something like
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"))

?

Thanks
Antonio


__________ Information from ESET NOD32 Antivirus, version of virus signature database 5534 (20101015) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




More information about the grass-dev mailing list