[GRASS-dev] d.mon/d.rast from within python script gives empty monitor

Dear devs,

I am trying to generate maps as part of a python script. Running the following directly on the python command (python tab in main gui) works.

import grass.script as gs
gs.run_command("d.mon", start="wx1")
gs.run_command("d.rast", map="mymap")

However, when running the same from a python scrip (e.g., using the GRASS Simple Python Editor) results in an empty monitor. Any idea what I am doing wrong (or is this a bug)?

Rgds,

Paulo

Hi,

2017-03-04 12:17 GMT+01:00 Paulo van Breugel <p.vanbreugel@gmail.com>:

gs.run_command("d.mon", start="wx1")

try to add with reasonable number of seconds

time.sleep(...)

gs.run_command("d.rast", map="mymap")

It should help. Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On 04-03-17 18:36, Martin Landa wrote:

Hi,

2017-03-04 12:17 GMT+01:00 Paulo van Breugel <p.vanbreugel@gmail.com>:

gs.run_command("d.mon", start="wx1")

try to add with reasonable number of seconds

time.sleep(...)

gs.run_command("d.rast", map="mymap")

It should help. Martin

Yes, it did, thanks Martin. Out of curiosity, why is this needed (unlike when running from the command line)?