I have
subprocess.call(['errcalc', os.path.join(current_out_dir,
'drclog')], stdout=error_summary)
subprocess.call(['errcalc', os.path.join(current_out_dir,
'drclog')], stdout=full_error_summary)
Instead of running the command twice, can I have subprocess.call() output to multiple stdout? Perhaps subprocess.call(['errcalc', os.path.join(current_out_dir, 'drclog')], stdout=[error_summary, full_error_summary])
or something?
Solution
subprocess.call(['errcalc', os.path.join(current_out_dir,
'drclog')], stdout=logfile)
for line in logfile:
error_summary.write(line)
full_error_summary.write(line)