On 13/02/12 16:11, Moritz Lennert wrote:
On 13/02/12 15:19, Johannes Radinger wrote:

#!/usr/bin/env python

import sys
import time

import grass.script as grass
import grass.script.setup as gsetup

def main():

print "start"
sys.stdout.flush()

grass.run_command("g.list",
type = "rast")

time.sleep(5)
print "1st g.list over"
sys.stdout.flush()

grass.run_command("g.list",
type = "rast")

time.sleep(5)
print "2nd g.list over"
sys.stdout.flush()

for i in ['FULL_HYDRO','LENGTH']:

grass.run_command("v.to.rast",
input = "streams@PERMANENT",
output = "rast_"+i,
type = "line",
use = "attr",
column = i)

time.sleep(5)

return 0

if __name__ == "__main__":
sys.exit(main())


Output:

Launching script '/Users/Johannes Radinger/Desktop/test2.py'...
(Mon Feb 13 15:08:07 2012)
/Users/Johannes Radinger/Desktop/test2.py
start
----------------------------------------------
raster files available in mapset<PERMANENT>:
basins elevation_shade lakes soils
elevation geology landuse
raster files available in mapset<user1>:
rast_FULL_HYDRO rast_LENGTH
----------------------------------------------
1st g.list over
----------------------------------------------
raster files available in mapset<PERMANENT>:
basins elevation_shade lakes soils
elevation geology landuse
raster files available in mapset<user1>:
rast_FULL_HYDRO rast_LENGTH
----------------------------------------------
ERROR: option<output>:<rast_FULL_HYDRO> exists.
ERROR: option<output>:<rast_LENGTH> exists.
2nd g.list over
(Mon Feb 13 15:08:23 2012) Command finished (15 sec)


Looks weird as "2nd g.list over" is printed after the ERROR, resp.
the ERROR is produced by v.to.rast before the print statement is
processed...

I launch the script from within GRASS6.5SVN (Mac OSX) from File ->
launch script.

Ok, I can reproduce your error using File->Launch script. No idea where
that comes from, I'll try to look into it.

For the time being, just use g.remove or launch your script in the
terminal.

This is a bit over my head as I don't have a good view of how the GUI works (CC to Martin), but AFAICT the script is run through RunCmd on line 599 in gui/wxpython/gui_core/goutput.py [1].

So it quite definitely seems a wxgui problem, but I don't know how to go further with this. You should probably file a bug report.

Moritz

[1] http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py#L599
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to