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

Moritz Lennert mlennert at club.worldonline.be
Thu Jun 11 09:37:36 PDT 2015


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



More information about the grass-dev mailing list