<div dir="ltr"><div class="gmail_default" style="font-family:pmingliu,serif;font-size:large"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14.399999618530273px;vertical-align:baseline;clear:both;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
Sorry for asking questions to just helping me debug my python script, but I really can't find where to be edited, and here's my script to generate new mapset,</p><pre class="" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:12px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-color:rgb(238,238,238);color:rgb(57,51,24);word-wrap:normal;line-height:18px">
<code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;color:rgb(34,34,34);white-space:inherit"><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">import</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> os
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">import</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> sys
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(134,134,134)">#set up GRASS environment variables</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">
sys</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">path</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">append</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">(</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">os</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">path</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">join</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">(</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">os</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">environ</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">[</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'GISBASE'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">],</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'etc'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">,</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'python'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">))</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">import</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> grass</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">script </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">as</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> g
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">import</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> grass</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">script</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">setup </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">as</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> gsetup
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(134,134,134)">#create new mapset in the location</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">
g</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">run_command</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">(</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'g.mapset'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'-c'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">,</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> mapset </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">=</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'watershed_analysis'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">,</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> location </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">=</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'newLocation'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">,</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> gisdb </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">=</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'C:\Users\Heinz\Documents\grassdata'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">)</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(134,134,134)">#check result</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">
</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(138,74,11)">print</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> g</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">.</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)">read_command</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">(</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'g.mapsets'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(0,0,0)"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(128,0,0)">'-l'</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(20,86,128)">)</span></code></pre>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14.399999618530273px;vertical-align:baseline;clear:both;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
The script runs fine but with no output, what mistake did I makeĦH</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14.399999618530273px;vertical-align:baseline;clear:both;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:18px;background-color:rgba(248,248,248,0.6)">
I am using GRASS 6.4.3, python 2.7 under Windows 8.1</p></div></div>