[GRASS-user] syntax for setting GRASS_PNGFILE from Python script

Martin Landa landa.martin at gmail.com
Wed Sep 1 05:29:35 EDT 2010


Hi,

2010/8/31 Damian M <maddalena at nc.rr.com>:
> GRASS_PNGFILE=mywaycoolmap.png
> export GRASS_PNGFILE
>
> What is the proper syntax for setting this in Python?
>
> I have tried something like:
>
> def jpgMap():
>    #SET PNG OUTPUT FILE NAME
>    grass.run_command("g.gisenv", set="GRASS_PNGFILE=testName.png")

GRASS_PNGFILE is a shell environment variable, not a GRASS gisenv
variable [1]. To set environment variable use e.g. os.putenv()

os.putenv('GRASS_PNGFILE', 'test.png')

Martin

[1] http://grass.osgeo.org/grass64/manuals/html64_user/variables.html

-- 
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa


More information about the grass-user mailing list