On Tue, May 2, 2017 at 3:24 AM, Moritz Lennert <mlenn...@club.worldonline.be
> wrote:

> But I'm not against a wrapper. I added a prototype with limited
>> functionality to addons [1]. However, I'm not sure how to account for
>> large data - that's what discouraged me from creating a wrapper. The
>> Python subprocess documentation says use communicate() but its doc says
>> "The data read is buffered in memory, so do not use this method if the
>> data size is large or unlimited." [2] Do I have to do the buffering
>> myself then or is it just fine? Is there some code like this in GRASS?
>>
>
> Wouldn't using pipe_command() and feed_command() in the grass.script be a
> solution ?



I'm using pipe_command() which is just convenience function setting
stdout=PIPE. Similarly feed_command() is just setting stdin=PIPE which I'm
not using because I'm feeding the stdout of the other process directly
(stdin=first_process.stdout). What I don't understand, regardless of using
stdin=PIPE or stdin=first_process.stdout for the second process, is what
should be next.

https://grass.osgeo.org/grass70/manuals/libpython/script.html#script.core.pipe_command
https://grass.osgeo.org/grass70/manuals/libpython/script.html#script.core.feed_command
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to