[GRASS-dev] [GRASS GIS] #2665: d.* modules not working from python or bash scripts (GRASS 7.0, Linux / Windows7)

GRASS GIS trac at osgeo.org
Wed Apr 29 01:01:28 PDT 2015


#2665: d.* modules not working from python or bash scripts (GRASS 7.0, Linux /
Windows7)
-------------------------------------------------+-------------------------
 Reporter:  santipardo                           |      Owner:  grass-dev@…
     Type:  defect                               |     Status:  new
 Priority:  normal                               |  Milestone:  7.0.1
Component:  Display                              |    Version:  7.0.0
 Keywords:  d.mon, d.vect, d.rast, python,       |        CPU:  x86-64
  script, bash                                   |
 Platform:  All                                  |
-------------------------------------------------+-------------------------
 ''(I copy here this question from GIS.stackexhange, related to a possible
 bug when calling d.* modules from a script)''

 Do d.* commands from GRASS GIS 7.0 run from a python script? I'm trying
 with this code:

 {{{
 import grass.script as grass

 grass.run_command('d.mon', start="wx3", resolution = '1')
 grass.run_command('d.mon', select="wx3")
 grass.run_command('d.rast', map="M01relief")
 grass.run_command('d.mon', select="wx3")
 grass.run_command('d.vect', map="M03PTEtramos", color="black",  width='2')
 }}}

 When executing the complete script, the wx3 monitor starts, but remains
 empty. However, if I paste the commands one by one in GRASS Python
 Command-line, I get the layers drawn in the monitor. And using Cairo
 driver, I also get the layers drawn in a PNG file (directly from the
 script).

 In the aforementioned Python code, the monitor seems not to apply the
 code, because if I check for the monitor commands, I get no info:

 {{{
 grass.run_command('d.mon', flags="c")
 [Empty output]
 }}}

 (The monitor wx3 opens and remains empty)

 Using a Bash script, the monitor is again empty:

 {{{
 d.mon start=wx3 resolution=1
 d.rast map=M01relief
 d.vect map=M03PTEtramos color=black width=2
 d.redraw
 }}}

 But if I ask then for the list of commands I get results:

 {{{
 d.mon -c
 Enlistar comandos para el monitor <wx3>:
 d.rast map="M01relief" bgcolor="white"
 d.vect map="M03PTEtramos" layer="1" display="shape"
 type="point,line,boundary,area,face" color="black"
 fill_color="200:200:200" width=2 width_scale=1 icon="basic/x" size=5
 label_layer="1" label_color="red" label_bgcolor="none" label_bcolor="none"
 label_size=8 xref="left" yref="center"
 }}}

 Actually, doing d.redraw from command line (not from the script), shows
 the map.

 The problem happens both in Linux Mint 64 bits and Windows7 64 bits (the
 second running in a VirtualBox machine)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2665>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list