in my parent script, I do the following:
fout=open(outfile,"w")
ferr = open(errfile,"w")
subprocess.call("1.py",stdout=fout,stderr=ferr,shell=True)
In the 1.py
, script, I want most of the log message to go to log file, but some messages, I want to print on Console, based on the Print Conditions:
print "Hello World"
but it is printing to outfile, which I wanted to print on console as well, I tried doing
sys.__stdout__.write("Hello World");
but that aslso doesn't work. Any help would be appreciated!