[GRASS-dev] how to work around "Arument list too long" error in a GRASS python script ?

Paulo van Breugel p.vanbreugel at gmail.com
Thu Jun 11 10:31:52 PDT 2015



On 11-06-15 19:22, Anna Petrášová wrote:
>
>
> On Thu, Jun 11, 2015 at 12:37 PM, Moritz Lennert 
> <mlennert at club.worldonline.be <mailto:mlennert at club.worldonline.be>> 
> wrote:
>
>     Hello,
>
>     In a python script I have the following call:
>
>     grass.run_command('r.series',
>                        input = rate_maps,
>                        output = sum_rates,
>                        method = 'sum',
>                        overwrite = True,
>                        quiet=True)
>
>     rate_maps is a list which in one instance contains 8559 map names,
>     leading to an "OSError: [Errno 7] Argument list too long".
>
>     I know that in the shell I could use xargs to work around such a
>     problem. But how to do this in python ?
>
>     I could obviously loop through all maps and thus sum them
>     individually, but this just seems horribly inefficient.
>
>     Does anyone have a better solution ?
>
>     Moritz
>
>
> It seems we are hitting these issues quite often, we should consider 
> add input file as an option like many temporal modules already have. 
> But splitting as Nikos suggests has the advantage that you can 
> parallelize the computation.

+1 add input file as an option

>
> Anna
>
>     _______________________________________________
>     grass-dev mailing list
>     grass-dev at lists.osgeo.org <mailto:grass-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/grass-dev
>
>
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20150611/f47d6712/attachment.html>


More information about the grass-dev mailing list