subprocess - please enhance the documentation

Terry Reedy tjreedy at udel.edu
Tue May 20 13:43:15 EDT 2008


"Helmut Jarausch" <jarausch at igpm.rwth-aachen.de> wrote in message 
news:69fmseF329s6vU1 at mid.dfncis.de...
| 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)

1. Take a look at the existing 2.6 manual (on Python.org) to make sure it 
has not already been improved.  If not..

2. Post your suggestions on bugs.python.org and mark the item as 
documentation and stdlib.  Suggest the specific addition or change you 
would like to see.  If accepted, one of the doc-masters with add it with 
the needed formatting code and possibly stylistic changes.

| 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
| 






More information about the Python-list mailing list