[GRASS-user] retrieving a GRASS-python script return values

Glynn Clements glynn at gclements.plus.com
Wed Feb 9 19:14:58 EST 2011

katrin eggert wrote:

> I have built a GRASSPy Script to read a few text files (r.in.text.py)
> At the end of the file I do a return of a list of integers with:
> values=[1,2,4,5,6,43,32,553,2]
> return values
> My question is: I have another GRASS python script that and I want to call
> r.in.text.py to get these values.
> What GRASS python functionality shall i use to retrieve these values? (I
> suppose grass.run_command is not a good idea).

Have r.text.py write the data to stdout, then invoke r.text.py via
grass.read_command() or grass.parse_command().

For more complex data, you could add an option to r.text.py to write
the data in Python's "pickle" format.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list