In case your process produces significant amounts of output that you don't want to buffer in memory, you should redirect the output to the electronic trash can:
with open(os.devnull, "w") as f:
subprocess.call(["pdflatex", filename], stdout=f)
The variable os.devnull
is the name of the null device of your operating system (/dev/null
on most OSes, nul
on the other one).