[GRASS-user] [d.*] command not executing from standalone script

Martin Landa landa.martin at gmail.com
Sun Jan 8 04:28:19 PST 2017


Hi,

2017-01-08 11:06 GMT+01:00 Ang Sherpa <angsherpa232 at gmail.com>:
> However, still no changes, the [d.*] doesnot starts. Am I missing something?
> I have attached the script herewith this mail.


see my last replay:

"""
interactive monitors require running GRASS. It is probably reason why
wx monitor is not even launched since your script already terminates
(and GRASS session too). It has no reason to use interactive monitors
outside of GRASS. If you modify your script like:

gscript.run_command('d.mon', stop='wx6') # we asssume that there is
already monitors hanging from last run
gscript.run_command('d.mon',start='wx6',resolution='1')
time.sleep(2)
gscript.run_command('d.rast',map='elevation')
time.sleep(200)
os.remove(rcfile)

Then monitor shows and will running 200sec. But it has no sense. So I
suggest you to use:

1) file-based monitors (which is natural for script, generate
something, render to file and close)

script.run_command('d.mon',start='cairo',resolution='1',
output="/path/image.png")
# no need to sleep
gscript.run_command('d.rast',map='elevation')
gscript.run_command('d.mon', stop='cairo')

or

2) launch your script from running GRASS
"""

Result: when using interactive monitors you need to have active GRASS
session running on background. Ma

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


More information about the grass-user mailing list