I have the following code:
sourcefile = open(filein, "r")
targetfile = open(pathout, "w")
content= sourcefile.read():
p = Popen([SCRIPT], stdout=targetfile, stdin=PIPE)
p.communicate(content)
sourcefile.close()
targetfile.close()
The data in sourcefile is quite large, so it takes a lot of memory/swap to store it in 'content'. I tried to send the file directly to stdin with stdin=sourcefile, which works except the external script 'hangs', ie: keeps waiting for an EOF. This might be a bug in the external script, but that is out of my control for now..
Any advice on how to send the large file to my external script?