<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 1:46 PM, Moritz Lennert <span dir="ltr"><<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 11/06/15 19:02, Nikos Alexandris wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>> [2015-06-11 18:37:36 +0200]:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
In a python script I have the following call:<br>
<br>
grass.run_command('r.series',<br>
                     input = rate_maps,<br>
                     output = sum_rates,<br>
                     method = 'sum',<br>
                     overwrite = True,<br>
                     quiet=True)<br>
<br>
rate_maps is a list which in one instance contains 8559 map names,<br>
leading to an "OSError: [Errno 7] Argument list too long".<br>
<br>
I know that in the shell I could use xargs to work around such a<br>
problem. But how to do this in python ?<br>
</blockquote>
<br>
What it the OS limit for it?<br>
</blockquote>
<br></span>
I suppose this is ARG_MAX ?<br>
<br>
getconf ARG_MAX<br>
2097152<br>
<br>
A text file with all file names only uses 144551 bytes.<br>
<br>
Or is there another limit I should look at ?<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I could obviously loop through all maps and thus sum them individually,<br>
but this just seems horribly inefficient.<br>
<br>
Does anyone have a better solution ?<br>
</blockquote>
<br>
- Maybe split in two or three sessions (instead of looping over all)?<br>
</blockquote>
<br></span>
Yes, thanks, I can do that. I'll also try the file option mentioned by Anna (r.series actually has one). Didn't think of that.<br></blockquote><div><br></div><div>Oh, I didn't know that it already has it. Good to know! </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks to both of you !<span class="HOEnZb"><font color="#888888"><br>
<br>
Moritz<br>
<br>
<br>
</font></span></blockquote></div><br></div></div>