<div dir="ltr"><div><div><div>Hi,<br><br></div>I would like to check if the file defined as output in a python script already exists and fire an error when it exists and the overwrite flag is not set. Furhtermore I'd like<br>
to check this already in the beginning before all calculations in the script are executed. I thought about something like:<br><br>output = options['output']<br> if (grass.find_file(name = output, element = 'cell')['file'] and grass.read_command("g.gisenv", get = "GRASS_OVERWRITE")!=1):<br>
grass.fatal(_("Output file exists already, either change output name or set overwrite-flag"))<br><br></div>but what is the correct way to get the information if the overwrite flag is set <br>or not for that script? The GRASS-OVERWRITE variable is not set although the script is launched with --overwrite. So how to get this info?<br>
<br></div>/Johannes<br></div>