<div class="gmail_quote"><div><br></div><div>Hi,</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt;<br>
&gt; &gt; Have you tried adding flags = &#39;-o&#39; as an argument to<br>
&gt; &gt; grass.run_command? That will overwrite the output raster if it already<br>
&gt; &gt; exists.<br>
&gt;<br>
&gt; Actually, it will raise a ScriptError if you&#39;re running anything later<br>
&gt; than 6.4.1. If you want to pass the --overwrite flag to the module,<br>
&gt; you should pass overwrite=True to run_command() etc.<br>
<br>
so if I understand you correctly: This error is normal to GRASS6.5SVN?<br>
<br>
It is really an interesting behavior. I remove the raster maps manually (with g.remove and f-flag) and cross check (g.list) so that the raster maps a really removed. Although the script gives this error...<br>
However when I include g.remove in the script to remove them before v.to.rast everything works fine.<br>
Interestingly when I include g.list before v.to.rast in the script (and all raster maps were removed before), g.list states that the maps are existing... So it seems that there is somehow a problem with the script/pyhton/GRASS interaction... although it works for Moritz Lennert.<br>

Somehow it seems that v.to.rast has two passes (or more)...and the first one is performed even before g.list is processed in the script???<br>
<br>
About my setup: GRASS6.5SVN (rev50782) on Mac OS X, Python 2.6.6...<br>
<br>
and here the script with g.remove and g.list:<br>
<br>
#!/usr/bin/env python<br>
<br>
import sys<br>
<br>
import grass.script as grass<br>
import grass.script.setup as gsetup<br>
<br>
def main():<br>
<br>
<br>
    #grass.run_command(&quot;g.remove&quot;,<br>
        #                               flags = &quot;f&quot;,<br>
     #               rast = &quot;rast_FULL_HYDRO,rast_LENGTH&quot;)<br>
<br>
    grass.run_command(&quot;g.list&quot;,<br>
                                        type = &quot;rast&quot;)<br>
<br>
<br>
<br>
    for i in [&#39;FULL_HYDRO&#39;,&#39;LENGTH&#39;]:<br>
<br>
        grass.run_command(&quot;v.to.rast&quot;,<br>
                    input = &quot;streams@PERMANENT&quot;,<br>
                    output = &quot;rast_&quot;+i,<br>
                    type = &quot;line&quot;,<br>
                    use = &quot;attr&quot;,<br>
                    column = i)<br>
<br>
    return 0<br>
<br>
if __name__ == &quot;__main__&quot;:<br>
    sys.exit(main())<br>
<br>
<br>
<br>
And my output with although all maps were removed manually with g.remove and cross checked:<br>
<br>
Launching script &#39;/Users/Johannes Radinger/Desktop/test2.py&#39;...<br>
(Mon Feb 13 11:12:27 2012)<br>
/Users/Johannes Radinger/Desktop/test2.py<br>
----------------------------------------------<br>
raster files available in mapset &lt;PERMANENT&gt;:<br>
basins          elevation_shade lakes           soils<br>
elevation       geology         landuse<br>
raster files available in mapset &lt;user1&gt;:<br>
rast_FULL_HYDRO rast_LENGTH<br>
----------------------------------------------<br>
ERROR: option &lt;output&gt;: &lt;rast_FULL_HYDRO&gt; exists.<br>
ERROR: option &lt;output&gt;: &lt;rast_LENGTH&gt; exists.<br>
(Mon Feb 13 11:12:27 2012) Command finished (0 sec)<br></blockquote><div><br></div><div> </div><div>Please try quiet option to remove them. Furthermore, remove them separately:</div><div><br></div><div>grass.run_command(&#39;g.remove&#39;, rast = &#39;rast_FULL_HYDRO&#39;, quiet = True) </div>
<div>grass.run_command(&#39;g.remove&#39;, rast = &#39;rast_LENGTH&#39;, quiet = True) </div><div><br></div><div>HTH,</div><div>regards madi</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
<br>
<br>
Of course I can use the overwrite-flag (overwrite=TRUE) to overcome the problem (or use g.remove in the script). I just wanted to know if that is a plattform specific problem, a problem with my script or just a bug in the GRASS-Python code...<br>

<br>
Best regards<br>
/johannes<br>
<br><br>
</blockquote></div><br>