<div dir="ltr">Hi Nicolas,<div><br></div><div>check_output() is higher level and easier to use. I recommend it: <a href="https://docs.python.org/2.7/library/subprocess.html#subprocess.check_output">https://docs.python.org/2.7/library/subprocess.html#subprocess.check_output</a>. There's a note in there about capturing stderr as well. If gdal_grid is running successfully, there may not be anything in stdout.<br></div><div><br></div><div>I think I see a bug in your code. The function you give to the pool should take a single arg, not a list. imap_unordered() will pass elements of your list to workers, not the entire list.</div><div><br></div><div>Good luck!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 12, 2018 at 9:13 AM, Nicolas Cadieux <span dir="ltr"><<a href="mailto:nicolas.cadieux@archeotec.ca" target="_blank">nicolas.cadieux@archeotec.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am not an experienced programmer.  I am calling gdal_grid from a python script.  I am using p.imap_ unordered to multiprocess the script.  The idea is the following:<br>
<br>
--------------------<br>
<br>
def gdal_Grid(fileList):<br>
    gdal_Grid_Cmd = 'gdal_grid -l ....'<br>
    shell = subprocess.Popen(r'c:\OSGeo4W6<wbr>4\OSGeo4W.bat', stdin=subprocess.PIPE)<br>
    shell.communicate(gdal_Grid_Cm<wbr>d)<br>
    return  'done'<br>
<br>
-------------------------<br>
<br>
lst = [c:\temp.csv....]<br>
<br>
if __name__ == '__main__':<br>
    p = Pool(2)<br>
    for x in p.imap_unordered(gdal_Grid,lst<wbr>):<br>
        print x<br>
<br>
<br>
The Question:<br>
I would like to print the output (standard out???) from gdal_grid. I can't figure how to use stdout=subprocess.PIPE. Can you help me?<br>
Thanks<br>
Nicolas<br>
<br>
______________________________<wbr>_________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/gdal-dev</a></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Sean Gillies</div></div>
</div>