From: hiral on 14 Jun 2010 09:31 Hi, Do we have any facility to append file from Popen()/call(); see below example... 1 import subprocess 2 f=open('log', 'w') 3 ...# writing some log-into into log file 4 p = subprocess.Popen(cmd, stdout=f, stderr=f) # (Q) 5 ...# do remaining stuff Q: At line# 4, the output of the 'cmd' will wipe-out everything in 'log' file. So to avoid this do we have any mechanism to append into the existing file from subprocess. Currently I am doing following... p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) o, e = p.communicate() print >> log, o print >> log, e Pleaese let me know if there is any better mechanism. Thank you in advance.
|
Pages: 1 Prev: biopython Next: pyqt4 vs pygtk2 vs pyjamas (was: GUIs - A Modest Proposal) |