From my Python script I need to call consequently two external binaries in order to process file in two steps:
import os, subprocess
sbp = subprocess.Popen(['program_1', '-i', 'input.file', '-o', 'temp.file'])
sbp = subprocess.Popen(['program_2', '-i', 'temp.file', '-o', 'output.file'])
os.remove('temp.file')
However, it would be nice to speed-up the pipe and reduce disk usage by using virtual RAM-based files instead of 'physical' disk-based. I know that I can use StringIO
or tempfile.SpooledTemporaryFile()
to handle virtual files within Python script, but is there a possibility to pass the link to such file to an external binary?
At the end
tmp
will be delete.