I'm trying to pass a java file via python and write the shell output into a log .txt file. This is working except that my manual breaks are being added to the end of the file. Any advice on why .write
is happening after subprocess.call
? I'm very new to Python. Thanks
Code Snippet
import subprocess
outfile = open('c:\\log2.txt', 'a')
outfile.write("\n\n")
outfile.write("-------------------------BEGIN NEW LOG--------------------------------------")
outfile.write("\n\n")
subprocess.call(['java.exe',
'-cp',
'c:\\dev\\dataloader\\dataloader-36.0.0-uber.jar',
'-Dsalesforce.config.dir=c:\\dev\\dataloader\\',
'com.salesforce.dataloader.process.ProcessRunner',
'process.name=csvCRExtract'],
stdout=outfile)
outfile.close()