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

katrin eggert katrineggert1980 at gmail.com
Wed Feb 23 07:47:05 EST 2011


hello Glynn
I'm trying to parse a list of strings like this:
       sys.stdout.write(output_v)
And I get this error
TypeError: argument 1 must be string or read-only character
buffer, not list
Any suggestion to do this?
Thanks

2011/2/10 Glynn Clements <glynn at gclements.plus.com>

>
> 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>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110223/d9b8e83e/attachment.html


More information about the grass-user mailing list