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 the source file is quite large, so it takes a lot of memory / swap to store in the "contents". I tried to send the file directly to stdin using stdin = sourcefile, which works, except for the external script 'freezes', that is: it continues to wait for EOF. It may be an error in an external script, but it is no longer at my disposal.
Any tips on how to send a large file to an external script?
source
share