
jarausch at igpm
May 20, 2008, 3:18 AM
Views: 52
Permalink
|
|
subprocess - please enhance the documentation
|
|
Hi, I'd like to suggest to add a few lines to chapter 17.1.3.5 "Replacing os.popen" (Python Doc 2.5.2) I have used the following code in the past ARC='MyDumpFile' tar_inp= os.popen('/bin/tar cjf '+ARC+' -T -','w') .... tar_exit_code= tar_inp.close() if tar_exit_code != None and tar_exit_code % 256 : print "some error messages" When replacing this - as suggested - by TAR= Popen(('/bin/tar','cjf',ARC,'-T','-'),stdin=PIPE) tar_inp= TAR.stdin .... tar_inp.close() always returns None. So I have replaced this by tar_inp.close() tar_exit_code= TAR.wait() if tar_exit_code != 0 : print "some error messages" Perhaps a few lines telling about this would be helpful. Thanks, Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list
|