<div dir="ltr"><span style="font-size:12.8000001907349px">Actually, scratch that. The script ran once, but now when I run it from the GUI it doesn't actually update the table, it just runs through without doing anything.<br></span><br>JDC</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 15, 2015 at 10:56 AM, Jake Chila <span dir="ltr"><<a href="mailto:jake.chila@gmail.com" target="_blank">jake.chila@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">HI all,<br><br>So I think I figured it out with help from Vaclav. When I launch the script from within the GUI the real errors are displayed in the Command Console. The issue I was having had to do with mislabelled column names; I was using numbers are the first character (my database management skills need some refinement apparently).<br><br>Now the script works when I launch it from within the GUI (no error messages in the command line), but when I launch the script from outside of Grass it is giving me grief.<br><br>Here is the code I am running:<div><br></div><div><div><font face="monospace, monospace">MAPS = grass.read_command('i.group',</font></div><div><font face="monospace, monospace">                          group='LE7_SEG',</font></div><div><font face="monospace, monospace">                          flags='g',</font></div><div><font face="monospace, monospace">                          quiet=True).splitlines()</font></div><div><br></div><br><div><font face="monospace, monospace">for maps in MAPS:</font></div><div><font face="monospace, monospace">    </font></div><div><font face="monospace, monospace">    band=maps.split('@',1)[0]</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    bnum=band[-2:]</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    grass.run_command('v.build',</font></div><div><font face="monospace, monospace">                      map='LE7_2001_SEG',</font></div><div><font face="monospace, monospace">                      option='build')</font></div><div><font face="monospace, monospace">                      </font></div><div><font face="monospace, monospace">    grass.run_command('v.rast.stats',</font></div><div><font face="monospace, monospace">                      map='LE7_2001_SEG',</font></div><div><font face="monospace, monospace">                      flags='c',</font></div><div><font face="monospace, monospace">                      raster=band,</font></div><div><font face="monospace, monospace">                      method='median',</font></div><div><font face="monospace, monospace">                      column_prefix='%s' % bnum)</font></div><div><font face="monospace, monospace">    </font></div><div><font face="monospace, monospace">    grass.run_command('v.db.update',</font></div><div><font face="monospace, monospace">                      map='LE7_2001_SEG',</font></div><div><font face="monospace, monospace">                      column='bright',</font></div><div><font face="monospace, monospace">                      qcolumn='bright+%s_median' %bnum)</font></div><div><font face="monospace, monospace">    </font></div><div><font face="monospace, monospace">    grass.run_command('v.db.dropcolumn',</font></div><div><font face="monospace, monospace">                      map='LE7_2001_SEG',</font></div><div><font face="monospace, monospace">                      column = '%s_median' % bnum)</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">I have to include the v.build command because, for some reason, the polygon topology needs to be rebuilt every time I try to use it. The code also includes all the environment settings needed to access GRASS which I know work because the script gets past the v.build command and repeatedly fails on the v.rast.stats command. <br><br>Thanks,<br><br>JDC</font></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, May 14, 2015 at 5:23 PM, Vaclav Petras <span dir="ltr"><<a href="mailto:wenzeslaus@gmail.com" target="_blank">wenzeslaus@gmail.com</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span><div><br>On Thu, May 14, 2015 at 2:00 PM, Jake Chila <<a href="mailto:jake.chila@gmail.com" target="_blank">jake.chila@gmail.com</a>> wrote:<br>><br>> The first issue I ran into was trying to the python code (about halfway down the page, "for maps in MAPS"). I have changed the parameters so they suit GRASS 7.0 but I still receive this error:<br>><br>> Traceback (most recent call last):<br>>   File "C:\Users\Jacob\Desktop\Python\SEG_DB_MAN.py", line 111, in <module><br>>     column_prefix='%s' % bnum)<br>>   File "C:\Program Files (x86)\GRASS GIS 7.0.0\etc\python\grass\script\core.py", line 375, in run_command<br>>     return handle_errors(returncode, returncode, args, kwargs)<br>>   File "C:\Program Files (x86)\GRASS GIS 7.0.0\etc\python\grass\script\core.py", line 310, in handle_errors<br>>     returncode=returncode)<br>> CalledModuleError: Module run None ['v.rast.stats', '-c', 'map=LE7_2001_SEG', 'column_prefix=B1', 'method=median', 'raster=LE7_ATCORR_2001_B1'] ended with error<br>> Process ended with non-zero return code 1. See errors in the (error) output.<br><br></div></span>Hi, are there any other errors above or elsewhere the output? The actual error messages start with "ERROR:". (I guess I should add this note to the error message.) Vaclav<br></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>