I call the subprocess, I want the output of the subprocess to be written to an already open file. I am using the following code:
f1=open('solve.out','w')
f_err = open('mor.err', "w")
arguments=[file.exe,arg1,arg2,...]
p=subprocess.Popen(arguments,stdout=f1, stderr=f_err)
p.wait()
f1.close()
f_err.close()
This works fine as I get real-time output from .exe in my program. However, the outputs are written on one line. As standalone, the output appears with new lines.
I tried universal_newlines or p.communicate () with no success.
edit 1: windows10 Python version 2.7.13
edit 2: Hex file

source
share